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

chore: upgrade to latest protocol contracts #3029

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions e2e/runner/v2_setup_evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,43 @@ func (r *E2ERunner) SetupEVMV2() {
require.NoError(r, err)
r.Logger.Info("Gateway EVM contract address: %s, tx hash: %s", gatewayEVMAddr.Hex(), txGateway.Hash().Hex())

r.Logger.Info("Deploying ERC20Custody contract")
erc20CustodyNewAddr, txCustody, erc20CustodyNew, err := erc20custodyv2.DeployERC20Custody(
// Deploy erc20custody proxy contract

r.Logger.Info("Deploying ERC20Custody proxy contract")
erc20CustodyAddr, txCustody, _, err := erc20custodyv2.DeployERC20Custody(r.EVMAuth, r.EVMClient)
require.NoError(r, err)

ensureTxReceipt(txCustody, "ERC20Custody deployment failed")

erc20CustodyABI, err := erc20custodyv2.ERC20CustodyMetaData.GetAbi()
require.NoError(r, err)

// Encode the initializer data
initializerData, err = erc20CustodyABI.Pack("initialize", r.GatewayEVMAddr, r.TSSAddress, r.Account.EVMAddress())
require.NoError(r, err)

// Deploy erc20custody proxy contract
erc20CustodyProxyAddress, erc20ProxyTx, _, err := erc1967proxy.DeployERC1967Proxy(
r.EVMAuth,
r.EVMClient,
r.GatewayEVMAddr,
r.TSSAddress,
r.Account.EVMAddress(),
erc20CustodyAddr,
initializerData,
)
require.NoError(r, err)

r.ERC20CustodyV2Addr = erc20CustodyNewAddr
r.ERC20CustodyV2 = erc20CustodyNew
r.ERC20CustodyV2Addr = erc20CustodyProxyAddress
r.ERC20CustodyV2, err = erc20custodyv2.NewERC20Custody(erc20CustodyProxyAddress, r.EVMClient)
require.NoError(r, err)
r.Logger.Info(
"ERC20CustodyV2 contract address: %s, tx hash: %s",
erc20CustodyNewAddr.Hex(),
erc20CustodyAddr.Hex(),
txCustody.Hash().Hex(),
)

ensureTxReceipt(txCustody, "ERC20CustodyV2 deployment failed")

// set custody contract in gateway
txSetCustody, err := r.GatewayEVM.SetCustody(r.EVMAuth, erc20CustodyNewAddr)
txSetCustody, err := r.GatewayEVM.SetCustody(r.EVMAuth, erc20CustodyProxyAddress)
require.NoError(r, err)

// deploy test dapp v2
Expand All @@ -97,6 +112,7 @@ func (r *E2ERunner) SetupEVMV2() {
// check contract deployment receipt
ensureTxReceipt(txDonation, "EVM donation tx failed")
ensureTxReceipt(txProxy, "Gateway proxy deployment failed")
ensureTxReceipt(erc20ProxyTx, "ERC20Custody proxy deployment failed")
ensureTxReceipt(txSetCustody, "Set custody in Gateway failed")
ensureTxReceipt(txTestDAppV2, "TestDAppV2 deployment failed")

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240819143729-b8229cd7b410
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241022142534-03043003e2b5
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0
gopkg.in/yaml.v2 v2.4.0
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,8 @@ github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2 h1:gd2uE0
github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2/go.mod h1:x7Bkwbzt2W2lQfjOirnff0Dj+tykdbTG1FMJPVPZsvE=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240819143729-b8229cd7b410 h1:sBeVX63s/qmfT1KnIKj1Y2SK3PsFpAM/P49ODcD1CN8=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240819143729-b8229cd7b410/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241022142534-03043003e2b5 h1:eJ/yEZdM4erETXdSnB8tP0RVGdtumxFXFB6ElAjuieU=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241022142534-03043003e2b5/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w=
github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U=
github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
Expand Down
2 changes: 1 addition & 1 deletion pkg/contracts/testdappv2/TestDAppV2.abi
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"type": "bytes"
}
],
"name": "onCrossChainCall",
"name": "onCall",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
Expand Down
2 changes: 1 addition & 1 deletion pkg/contracts/testdappv2/TestDAppV2.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
608060405234801561001057600080fd5b50610e3a806100206000396000f3fe60806040526004361061008a5760003560e01c8063a799911f11610059578063a799911f14610162578063c7a339a91461017e578063de43156e146101a7578063e2842ed7146101d0578063f592cbfb1461020d57610091565b806336e980a0146100965780634297a263146100bf578063660b9de0146100fc5780639291fe261461012557610091565b3661009157005b600080fd5b3480156100a257600080fd5b506100bd60048036038101906100b89190610900565b61024a565b005b3480156100cb57600080fd5b506100e660048036038101906100e19190610864565b610274565b6040516100f39190610b35565b60405180910390f35b34801561010857600080fd5b50610123600480360381019061011e9190610949565b61028c565b005b34801561013157600080fd5b5061014c60048036038101906101479190610900565b610347565b6040516101599190610b35565b60405180910390f35b61017c60048036038101906101779190610900565b61038a565b005b34801561018a57600080fd5b506101a560048036038101906101a09190610891565b6103b3565b005b3480156101b357600080fd5b506101ce60048036038101906101c99190610992565b610476565b005b3480156101dc57600080fd5b506101f760048036038101906101f29190610864565b61056f565b6040516102049190610b1a565b60405180910390f35b34801561021957600080fd5b50610234600480360381019061022f9190610900565b61058f565b6040516102419190610b1a565b60405180910390f35b610253816105de565b1561025d57600080fd5b61026681610634565b610271816000610688565b50565b60016020528060005260406000206000915090505481565b6102e781806040019061029f9190610b50565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610634565b6103448180604001906102fa9190610b50565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610688565b50565b6000600160008360405160200161035e9190610ab7565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b610393816105de565b1561039d57600080fd5b6103a681610634565b6103b08134610688565b50565b6103bc816105de565b156103c657600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161040393929190610ae3565b602060405180830381600087803b15801561041d57600080fd5b505af1158015610431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104559190610837565b61045e57600080fd5b61046781610634565b6104718183610688565b505050565b6104c382828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506105de565b156104cd57600080fd5b61051a82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610634565b61056882828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610688565b5050505050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000806000836040516020016105a59190610ab7565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b60006040516020016105ef90610ace565b60405160208183030381529060405280519060200120826040516020016106169190610ab7565b60405160208183030381529060405280519060200120149050919050565b60016000808360405160200161064a9190610ab7565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b80600160008460405160200161069e9190610ab7565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b60006106dd6106d884610bd8565b610bb3565b9050828152602081018484840111156106f9576106f8610d48565b5b610704848285610c83565b509392505050565b60008135905061071b81610d91565b92915050565b60008151905061073081610da8565b92915050565b60008135905061074581610dbf565b92915050565b60008083601f84011261076157610760610d2a565b5b8235905067ffffffffffffffff81111561077e5761077d610d25565b5b60208301915083600182028301111561079a57610799610d3e565b5b9250929050565b6000813590506107b081610dd6565b92915050565b600082601f8301126107cb576107ca610d2a565b5b81356107db8482602086016106ca565b91505092915050565b6000606082840312156107fa576107f9610d34565b5b81905092915050565b60006060828403121561081957610818610d34565b5b81905092915050565b60008135905061083181610ded565b92915050565b60006020828403121561084d5761084c610d52565b5b600061085b84828501610721565b91505092915050565b60006020828403121561087a57610879610d52565b5b600061088884828501610736565b91505092915050565b6000806000606084860312156108aa576108a9610d52565b5b60006108b8868287016107a1565b93505060206108c986828701610822565b925050604084013567ffffffffffffffff8111156108ea576108e9610d4d565b5b6108f6868287016107b6565b9150509250925092565b60006020828403121561091657610915610d52565b5b600082013567ffffffffffffffff81111561093457610933610d4d565b5b610940848285016107b6565b91505092915050565b60006020828403121561095f5761095e610d52565b5b600082013567ffffffffffffffff81111561097d5761097c610d4d565b5b610989848285016107e4565b91505092915050565b6000806000806000608086880312156109ae576109ad610d52565b5b600086013567ffffffffffffffff8111156109cc576109cb610d4d565b5b6109d888828901610803565b95505060206109e98882890161070c565b94505060406109fa88828901610822565b935050606086013567ffffffffffffffff811115610a1b57610a1a610d4d565b5b610a278882890161074b565b92509250509295509295909350565b610a3f81610c1f565b82525050565b610a4e81610c31565b82525050565b6000610a5f82610c09565b610a698185610c14565b9350610a79818560208601610c92565b80840191505092915050565b6000610a92600683610c14565b9150610a9d82610d68565b600682019050919050565b610ab181610c79565b82525050565b6000610ac38284610a54565b915081905092915050565b6000610ad982610a85565b9150819050919050565b6000606082019050610af86000830186610a36565b610b056020830185610a36565b610b126040830184610aa8565b949350505050565b6000602082019050610b2f6000830184610a45565b92915050565b6000602082019050610b4a6000830184610aa8565b92915050565b60008083356001602003843603038112610b6d57610b6c610d39565b5b80840192508235915067ffffffffffffffff821115610b8f57610b8e610d2f565b5b602083019250600182023603831315610bab57610baa610d43565b5b509250929050565b6000610bbd610bce565b9050610bc98282610cc5565b919050565b6000604051905090565b600067ffffffffffffffff821115610bf357610bf2610cf6565b5b610bfc82610d57565b9050602081019050919050565b600081519050919050565b600081905092915050565b6000610c2a82610c59565b9050919050565b60008115159050919050565b6000819050919050565b6000610c5282610c1f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610cb0578082015181840152602081019050610c95565b83811115610cbf576000848401525b50505050565b610cce82610d57565b810181811067ffffffffffffffff82111715610ced57610cec610cf6565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b610d9a81610c1f565b8114610da557600080fd5b50565b610db181610c31565b8114610dbc57600080fd5b50565b610dc881610c3d565b8114610dd357600080fd5b50565b610ddf81610c47565b8114610dea57600080fd5b50565b610df681610c79565b8114610e0157600080fd5b5056fea2646970667358221220d6765b67214e8cadf15b569ed63c4c4628bd833acf6926d71b9b6a6011fbb78064736f6c63430008070033
6080604052348015600f57600080fd5b50610e228061001f6000396000f3fe60806040526004361061008a5760003560e01c80639291fe26116100595780639291fe261461014e578063a799911f1461018b578063c7a339a9146101a7578063e2842ed7146101d0578063f592cbfb1461020d57610091565b806336e980a0146100965780634297a263146100bf5780635bcfd616146100fc578063660b9de01461012557610091565b3661009157005b600080fd5b3480156100a257600080fd5b506100bd60048036038101906100b89190610815565b61024a565b005b3480156100cb57600080fd5b506100e660048036038101906100e19190610894565b610274565b6040516100f391906108da565b60405180910390f35b34801561010857600080fd5b50610123600480360381019061011e9190610a03565b61028c565b005b34801561013157600080fd5b5061014c60048036038101906101479190610ac6565b610385565b005b34801561015a57600080fd5b5061017560048036038101906101709190610815565b610440565b60405161018291906108da565b60405180910390f35b6101a560048036038101906101a09190610815565b610483565b005b3480156101b357600080fd5b506101ce60048036038101906101c99190610b4d565b6104ac565b005b3480156101dc57600080fd5b506101f760048036038101906101f29190610894565b610560565b6040516102049190610bd7565b60405180910390f35b34801561021957600080fd5b50610234600480360381019061022f9190610815565b610580565b6040516102419190610bd7565b60405180910390f35b610253816105cf565b1561025d57600080fd5b61026681610625565b610271816000610679565b50565b60016020528060005260406000206000915090505481565b6102d982828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506105cf565b156102e357600080fd5b61033082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610625565b61037e82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610679565b5050505050565b6103e08180604001906103989190610c01565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610625565b61043d8180604001906103f39190610c01565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610679565b50565b600060016000836040516020016104579190610cd5565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b61048c816105cf565b1561049657600080fd5b61049f81610625565b6104a98134610679565b50565b6104b5816105cf565b156104bf57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016104fc93929190610cfb565b6020604051808303816000875af115801561051b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053f9190610d5e565b61054857600080fd5b61055181610625565b61055b8183610679565b505050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000806000836040516020016105969190610cd5565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b60006040516020016105e090610dd7565b60405160208183030381529060405280519060200120826040516020016106079190610cd5565b60405160208183030381529060405280519060200120149050919050565b60016000808360405160200161063b9190610cd5565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b80600160008460405160200161068f9190610cd5565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610722826106d9565b810181811067ffffffffffffffff82111715610741576107406106ea565b5b80604052505050565b60006107546106bb565b90506107608282610719565b919050565b600067ffffffffffffffff8211156107805761077f6106ea565b5b610789826106d9565b9050602081019050919050565b82818337600083830152505050565b60006107b86107b384610765565b61074a565b9050828152602081018484840111156107d4576107d36106d4565b5b6107df848285610796565b509392505050565b600082601f8301126107fc576107fb6106cf565b5b813561080c8482602086016107a5565b91505092915050565b60006020828403121561082b5761082a6106c5565b5b600082013567ffffffffffffffff811115610849576108486106ca565b5b610855848285016107e7565b91505092915050565b6000819050919050565b6108718161085e565b811461087c57600080fd5b50565b60008135905061088e81610868565b92915050565b6000602082840312156108aa576108a96106c5565b5b60006108b88482850161087f565b91505092915050565b6000819050919050565b6108d4816108c1565b82525050565b60006020820190506108ef60008301846108cb565b92915050565b600080fd5b6000606082840312156109105761090f6108f5565b5b81905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061094482610919565b9050919050565b61095481610939565b811461095f57600080fd5b50565b6000813590506109718161094b565b92915050565b610980816108c1565b811461098b57600080fd5b50565b60008135905061099d81610977565b92915050565b600080fd5b600080fd5b60008083601f8401126109c3576109c26106cf565b5b8235905067ffffffffffffffff8111156109e0576109df6109a3565b5b6020830191508360018202830111156109fc576109fb6109a8565b5b9250929050565b600080600080600060808688031215610a1f57610a1e6106c5565b5b600086013567ffffffffffffffff811115610a3d57610a3c6106ca565b5b610a49888289016108fa565b9550506020610a5a88828901610962565b9450506040610a6b8882890161098e565b935050606086013567ffffffffffffffff811115610a8c57610a8b6106ca565b5b610a98888289016109ad565b92509250509295509295909350565b600060608284031215610abd57610abc6108f5565b5b81905092915050565b600060208284031215610adc57610adb6106c5565b5b600082013567ffffffffffffffff811115610afa57610af96106ca565b5b610b0684828501610aa7565b91505092915050565b6000610b1a82610939565b9050919050565b610b2a81610b0f565b8114610b3557600080fd5b50565b600081359050610b4781610b21565b92915050565b600080600060608486031215610b6657610b656106c5565b5b6000610b7486828701610b38565b9350506020610b858682870161098e565b925050604084013567ffffffffffffffff811115610ba657610ba56106ca565b5b610bb2868287016107e7565b9150509250925092565b60008115159050919050565b610bd181610bbc565b82525050565b6000602082019050610bec6000830184610bc8565b92915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112610c1e57610c1d610bf2565b5b80840192508235915067ffffffffffffffff821115610c4057610c3f610bf7565b5b602083019250600182023603831315610c5c57610c5b610bfc565b5b509250929050565b600081519050919050565b600081905092915050565b60005b83811015610c98578082015181840152602081019050610c7d565b60008484015250505050565b6000610caf82610c64565b610cb98185610c6f565b9350610cc9818560208601610c7a565b80840191505092915050565b6000610ce18284610ca4565b915081905092915050565b610cf581610939565b82525050565b6000606082019050610d106000830186610cec565b610d1d6020830185610cec565b610d2a60408301846108cb565b949350505050565b610d3b81610bbc565b8114610d4657600080fd5b50565b600081519050610d5881610d32565b92915050565b600060208284031215610d7457610d736106c5565b5b6000610d8284828501610d49565b91505092915050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b6000610dc1600683610c6f565b9150610dcc82610d8b565b600682019050919050565b6000610de282610db4565b915081905091905056fea264697066735822122025955e53db0c70548d06ac6a34bfbe108bb3d183d8972d0b0c515e35a07f1fe864736f6c634300081a0033
Loading
Loading