-
Notifications
You must be signed in to change notification settings - Fork 3.9k
kt-devnet: minimal interop test: initiate message #14782
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f9fecbc
devnet-sdk: Plugin op-service ethclient
pcw109550 757cc44
Add low level client access
pcw109550 bd74d40
Use e2e wait util
pcw109550 d6ae1fc
kt-devnet: minimal interop test
pcw109550 88f1f63
Rename wallet's sendMessage to initiateMessage
pcw109550 6c41865
cleanup
pcw109550 2454c98
Only Expose ABI for now
pcw109550 a9085f6
simplify
pcw109550 49c740e
add value while tx building
pcw109550 edfbf74
Refactor to use call() method
pcw109550 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
788 changes: 788 additions & 0 deletions
788
devnet-sdk/contracts/bindings/l2tol2crossdomainmessenger.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
devnet-sdk/contracts/registry/client/l2tol2crossdomainmessenger.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package client | ||
|
|
||
| import ( | ||
| "github.com/ethereum-optimism/optimism/devnet-sdk/contracts/bindings" | ||
| "github.com/ethereum-optimism/optimism/devnet-sdk/interfaces" | ||
| "github.com/ethereum-optimism/optimism/devnet-sdk/types" | ||
| "github.com/ethereum/go-ethereum/accounts/abi" | ||
| "github.com/ethereum/go-ethereum/ethclient" | ||
| ) | ||
|
|
||
| type L2ToL2CrossDomainMessengerBinding struct { | ||
| contractAddress types.Address | ||
| client *ethclient.Client | ||
| binding *bindings.L2ToL2CrossDomainMessenger | ||
| abi *abi.ABI | ||
| } | ||
|
|
||
| var _ interfaces.L2ToL2CrossDomainMessenger = (*L2ToL2CrossDomainMessengerBinding)(nil) | ||
|
|
||
| func (b *L2ToL2CrossDomainMessengerBinding) ABI() *abi.ABI { | ||
| return b.abi | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package interop | ||
|
|
||
| import ( | ||
| "math/big" | ||
| "testing" | ||
|
|
||
| "github.com/ethereum-optimism/optimism/devnet-sdk/contracts/constants" | ||
| "github.com/ethereum-optimism/optimism/devnet-sdk/system" | ||
| "github.com/ethereum-optimism/optimism/devnet-sdk/testing/systest" | ||
| "github.com/ethereum-optimism/optimism/devnet-sdk/testing/testlib/validators" | ||
| sdktypes "github.com/ethereum-optimism/optimism/devnet-sdk/types" | ||
| "github.com/ethereum-optimism/optimism/op-service/testlog" | ||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/log" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func initiateMessageScenario(sourceChainIdx, destChainIdx uint64, walletGetter validators.WalletGetter) systest.InteropSystemTestFunc { | ||
| return func(t systest.T, sys system.InteropSystem) { | ||
| ctx := t.Context() | ||
|
|
||
| logger := testlog.Logger(t, log.LevelInfo) | ||
| logger = logger.With("test", "TestInitiateMessage", "devnet", sys.Identifier()) | ||
|
|
||
| chainA := sys.L2s()[sourceChainIdx] | ||
| chainB := sys.L2s()[destChainIdx] | ||
|
|
||
| logger = logger.With("sourceChain", chainA.ID(), "destChain", chainB.ID()) | ||
|
|
||
| // userA is funded at chainA and want to send message to chainB | ||
| userA := walletGetter(ctx) | ||
|
|
||
| // Initiate message | ||
| dummyAddress := common.Address{0x13, 0x37} | ||
| dummyMessage := []byte{0x13, 0x33, 0x33, 0x37} | ||
| logger.Info("Initiate message", "address", dummyAddress, "message", dummyMessage) | ||
| require.NoError(t, userA.InitiateMessage(chainB.ID(), dummyAddress, dummyMessage).Send(ctx).Wait()) | ||
| } | ||
| } | ||
|
|
||
| func TestInteropSystemInitiateMessage(t *testing.T) { | ||
| sourceChainIdx := uint64(0) | ||
| destChainIdx := uint64(1) | ||
| walletGetter, fundsValidator := validators.AcquireL2WalletWithFunds(sourceChainIdx, sdktypes.NewBalance(big.NewInt(1.0*constants.ETH))) | ||
|
|
||
| systest.InteropSystemTest(t, | ||
| initiateMessageScenario(sourceChainIdx, destChainIdx, walletGetter), | ||
| fundsValidator, | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.