Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NIT-2689] Add custom native tracer for cargo stylus replay #2560

Merged
merged 28 commits into from
Aug 24, 2024

Conversation

gligneul
Copy link
Contributor

@gligneul gligneul commented Aug 8, 2024

Currently, Cargo Stylus Replay uses a special JS tracer, which is not supported by 3rd party providers. This tracer captures all executed HostIOs and their metadata. This PR adds an equivalent native tracer (stylusTracer) that makes it easier for 3rd party providers to expose it to their users.

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Aug 8, 2024
@gligneul gligneul marked this pull request as ready for review August 9, 2024 16:52
Copy link
Contributor

@ganeshvanahalli ganeshvanahalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@diegoximenes diegoximenes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :), some comments, most are just doubts

system_tests/stylus_tracer_test.go Outdated Show resolved Hide resolved
system_tests/stylus_tracer_test.go Show resolved Hide resolved
system_tests/program_test.go Outdated Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Outdated Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Outdated Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work!

execution/gethexec/stylus_tracer.go Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Show resolved Hide resolved
system_tests/program_test.go Outdated Show resolved Hide resolved
execution/gethexec/stylus_tracer.go Show resolved Hide resolved
system_tests/stylus_tracer_test.go Show resolved Hide resolved
system_tests/stylus_tracer_test.go Show resolved Hide resolved
callArgs := argsForMulticall(vm.CALL, stylusMulticall, nil, []byte{0})
evmCall := argsForMulticall(vm.CALL, evmMulticall, nil, []byte{0})

for _, testCase := range []struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for now - but after both this and stylus_EVM are merged, we might be able to re-use some testcases between the two

@gligneul
Copy link
Contributor Author

I created a PR on Cargo Stylus to port the JS tracer improvements and add an option to use the native tracer: OffchainLabs/cargo-stylus#84

I tested it with the test node, and the native tracer works as expected.

Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small comments that can be done in a separate PR.
LGTM

// Copyright 2024, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE

package stack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will fit very well in util/containers

@tsahee tsahee enabled auto-merge August 24, 2024 01:08
@tsahee tsahee merged commit 16f41be into master Aug 24, 2024
13 checks passed
@tsahee tsahee deleted the gligneul/stylus-tracer branch August 24, 2024 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants