From f3829083e9a2c08d95de757e92a3a8d3d5935a02 Mon Sep 17 00:00:00 2001 From: mrekucci Date: Wed, 22 Nov 2023 18:28:09 +0400 Subject: [PATCH] feat: switch to the sepolia testnet (#4465) --- .github/workflows/beekeeper.yml | 2 +- go.mod | 6 +++--- go.sum | 12 ++++++------ pkg/config/chain.go | 13 +++++-------- pkg/node/chain.go | 2 +- pkg/postage/postagecontract/contract.go | 2 +- pkg/settlement/swap/chequebook/cashout_test.go | 2 +- pkg/settlement/swap/chequebook/chequebook.go | 2 +- pkg/settlement/swap/chequebook/factory.go | 5 ++--- pkg/settlement/swap/chequebook/factory_test.go | 12 ++++++------ pkg/settlement/swap/erc20/erc20.go | 2 +- pkg/settlement/swap/erc20/erc20_test.go | 2 +- pkg/settlement/swap/priceoracle/priceoracle.go | 2 +- pkg/settlement/swap/priceoracle/priceoracle_test.go | 2 +- pkg/storageincentives/staking/contract.go | 2 +- pkg/transaction/event_test.go | 2 +- 16 files changed, 33 insertions(+), 37 deletions(-) diff --git a/.github/workflows/beekeeper.yml b/.github/workflows/beekeeper.yml index aaa59eca449..156bbdec611 100644 --- a/.github/workflows/beekeeper.yml +++ b/.github/workflows/beekeeper.yml @@ -11,7 +11,7 @@ env: K3S_VERSION: "v1.22.17+k3s1" REPLICA: 3 RUN_TYPE: "PR RUN" - SETUP_CONTRACT_IMAGE_TAG: "1.0.4" + SETUP_CONTRACT_IMAGE_TAG: "2.0.5" BEELOCAL_BRANCH: "main" BEEKEEPER_BRANCH: "master" BEEKEEPER_METRICS_ENABLED: false diff --git a/go.mod b/go.mod index 3f9b836e08a..56e29ca007b 100644 --- a/go.mod +++ b/go.mod @@ -9,9 +9,9 @@ require ( github.com/casbin/casbin/v2 v2.35.0 github.com/coreos/go-semver v0.3.0 github.com/ethereum/go-ethereum v1.13.4 - github.com/ethersphere/go-price-oracle-abi v0.1.0 - github.com/ethersphere/go-storage-incentives-abi v0.6.0 - github.com/ethersphere/go-sw3-abi v0.4.0 + github.com/ethersphere/go-price-oracle-abi v0.2.0 + github.com/ethersphere/go-storage-incentives-abi v0.6.1-rc3 + github.com/ethersphere/go-sw3-abi v0.5.4 github.com/ethersphere/langos v1.0.0 github.com/go-playground/validator/v10 v10.11.1 github.com/gogo/protobuf v1.3.2 diff --git a/go.sum b/go.sum index 5c83af6a368..66fdec30c8e 100644 --- a/go.sum +++ b/go.sum @@ -238,12 +238,12 @@ github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1 github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg= github.com/ethereum/go-ethereum v1.13.4 h1:25HJnaWVg3q1O7Z62LaaI6S9wVq8QCw3K88g8wEzrcM= github.com/ethereum/go-ethereum v1.13.4/go.mod h1:I0U5VewuuTzvBtVzKo7b3hJzDhXOUtn9mJW7SsIPB0Q= -github.com/ethersphere/go-price-oracle-abi v0.1.0 h1:yg/hK8nETNvk+GEBASlbakMFv/CVp7HXiycrHw1pRV8= -github.com/ethersphere/go-price-oracle-abi v0.1.0/go.mod h1:sI/Qj4/zJ23/b1enzwMMv0/hLTpPNVNacEwCWjo6yBk= -github.com/ethersphere/go-storage-incentives-abi v0.6.0 h1:lfGViU/wJg/CyXlntNvTQpqQ2A4QYGLJ7jo+Pw+H+a4= -github.com/ethersphere/go-storage-incentives-abi v0.6.0/go.mod h1:SXvJVtM4sEsaSKD0jc1ClpDLw8ErPoROZDme4Wrc/Nc= -github.com/ethersphere/go-sw3-abi v0.4.0 h1:T3ANY+ktWrPAwe2U0tZi+DILpkHzto5ym/XwV/Bbz8g= -github.com/ethersphere/go-sw3-abi v0.4.0/go.mod h1:BmpsvJ8idQZdYEtWnvxA8POYQ8Rl/NhyCdF0zLMOOJU= +github.com/ethersphere/go-price-oracle-abi v0.2.0 h1:wtIcYLgNZHY4BjYwJCnu93SvJdVAZVvBaKinspyyHvQ= +github.com/ethersphere/go-price-oracle-abi v0.2.0/go.mod h1:sI/Qj4/zJ23/b1enzwMMv0/hLTpPNVNacEwCWjo6yBk= +github.com/ethersphere/go-storage-incentives-abi v0.6.1-rc3 h1:qvVPM1UUel3yJMAxSxEWjBo4sIo3HSCOXdcNrBVSizI= +github.com/ethersphere/go-storage-incentives-abi v0.6.1-rc3/go.mod h1:SXvJVtM4sEsaSKD0jc1ClpDLw8ErPoROZDme4Wrc/Nc= +github.com/ethersphere/go-sw3-abi v0.5.4 h1:unO7lCzrgUH7gu3qAB34ljqtDc/aRD+Jp1wjCfLXvbk= +github.com/ethersphere/go-sw3-abi v0.5.4/go.mod h1:BmpsvJ8idQZdYEtWnvxA8POYQ8Rl/NhyCdF0zLMOOJU= github.com/ethersphere/langos v1.0.0 h1:NBtNKzXTTRSue95uOlzPN4py7Aofs0xWPzyj4AI1Vcc= github.com/ethersphere/langos v1.0.0/go.mod h1:dlcN2j4O8sQ+BlCaxeBu43bgr4RQ+inJ+pHwLeZg5Tw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= diff --git a/pkg/config/chain.go b/pkg/config/chain.go index fcac751c60c..7d422e4ce19 100644 --- a/pkg/config/chain.go +++ b/pkg/config/chain.go @@ -41,16 +41,13 @@ var ( NetworkID: abi.TestnetNetworkID, PostageStampStartBlock: abi.TestnetPostageStampBlockNumber, NativeTokenSymbol: "ETH", - SwarmTokenSymbol: "gBZZ", + SwarmTokenSymbol: "sBZZ", StakingAddress: common.HexToAddress(abi.TestnetStakingAddress), PostageStampAddress: common.HexToAddress(abi.TestnetPostageStampAddress), RedistributionAddress: common.HexToAddress(abi.TestnetRedistributionAddress), - SwapPriceOracleAddress: common.HexToAddress("0x0c9de531dcb38b758fe8a2c163444a5e54ee0db2"), - CurrentFactoryAddress: common.HexToAddress("0x73c412512E1cA0be3b89b77aB3466dA6A1B9d273"), - LegacyFactoryAddresses: []common.Address{ - common.HexToAddress("0xf0277caffea72734853b834afc9892461ea18474"), - }, + SwapPriceOracleAddress: common.HexToAddress("0xe821533d30A4250e50812Aa060EEb2E8Ef3D98f6"), + CurrentFactoryAddress: common.HexToAddress("0x989F4d301d7333249362B2484BeE0D501AB01DCa"), StakingABI: abi.TestnetStakingABI, PostageStampABI: abi.TestnetPostageStampABI, @@ -65,13 +62,13 @@ var ( SwarmTokenSymbol: "xBZZ", StakingAddress: common.HexToAddress(abi.MainnetStakingAddress), - PostageStampAddress: common.HexToAddress(abi.MainnetPostageStampAddress), + PostageStampAddress: common.HexToAddress(abi.MainnetPostageStampStampAddress), RedistributionAddress: common.HexToAddress(abi.MainnetRedistributionAddress), SwapPriceOracleAddress: common.HexToAddress("0x0FDc5429C50e2a39066D8A94F3e2D2476fcc3b85"), CurrentFactoryAddress: common.HexToAddress("0xc2d5a532cf69aa9a1378737d8ccdef884b6e7420"), StakingABI: abi.MainnetStakingABI, - PostageStampABI: abi.MainnetPostageStampABI, + PostageStampABI: abi.MainnetPostageStampStampABI, RedistributionABI: abi.MainnetRedistributionABI, } ) diff --git a/pkg/node/chain.go b/pkg/node/chain.go index bd49bc3ac02..547ce452cf3 100644 --- a/pkg/node/chain.go +++ b/pkg/node/chain.go @@ -383,7 +383,7 @@ func (m noOpChainBackend) Metrics() []prometheus.Collector { } func (m noOpChainBackend) CodeAt(context.Context, common.Address, *big.Int) ([]byte, error) { - return common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_4_0), nil + return common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_5_4), nil } func (m noOpChainBackend) CallContract(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error) { return nil, errors.New("disabled chain backend") diff --git a/pkg/postage/postagecontract/contract.go b/pkg/postage/postagecontract/contract.go index 234cc4afdd8..9c0e0027d10 100644 --- a/pkg/postage/postagecontract/contract.go +++ b/pkg/postage/postagecontract/contract.go @@ -24,7 +24,7 @@ import ( var ( BucketDepth = uint8(16) - erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_3_1) + erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_5_4) ErrBatchCreate = errors.New("batch creation failed") ErrInsufficientFunds = errors.New("insufficient token balance") diff --git a/pkg/settlement/swap/chequebook/cashout_test.go b/pkg/settlement/swap/chequebook/cashout_test.go index e435ce2f6ad..f05a052bd51 100644 --- a/pkg/settlement/swap/chequebook/cashout_test.go +++ b/pkg/settlement/swap/chequebook/cashout_test.go @@ -21,7 +21,7 @@ import ( ) var ( - chequebookABI = abiutil.MustParseABI(sw3abi.ERC20SimpleSwapABIv0_3_1) + chequebookABI = abiutil.MustParseABI(sw3abi.ERC20SimpleSwapABIv0_5_4) chequeCashedEventType = chequebookABI.Events["ChequeCashed"] chequeBouncedEventType = chequebookABI.Events["ChequeBounced"] ) diff --git a/pkg/settlement/swap/chequebook/chequebook.go b/pkg/settlement/swap/chequebook/chequebook.go index b6e47b4a632..f73f07c6bc3 100644 --- a/pkg/settlement/swap/chequebook/chequebook.go +++ b/pkg/settlement/swap/chequebook/chequebook.go @@ -38,7 +38,7 @@ var ( // ErrInsufficientFunds is the error when the chequebook has not enough free funds for a user action ErrInsufficientFunds = errors.New("insufficient token balance") - chequebookABI = abiutil.MustParseABI(sw3abi.ERC20SimpleSwapABIv0_3_1) + chequebookABI = abiutil.MustParseABI(sw3abi.ERC20SimpleSwapABIv0_5_4) chequeCashedEventType = chequebookABI.Events["ChequeCashed"] chequeBouncedEventType = chequebookABI.Events["ChequeBounced"] ) diff --git a/pkg/settlement/swap/chequebook/factory.go b/pkg/settlement/swap/chequebook/factory.go index 41d029b23bc..91e709fb5a3 100644 --- a/pkg/settlement/swap/chequebook/factory.go +++ b/pkg/settlement/swap/chequebook/factory.go @@ -24,7 +24,7 @@ var ( ErrNotDeployedByFactory = errors.New("chequebook not deployed by factory") errDecodeABI = errors.New("could not decode abi data") - factoryABI = abiutil.MustParseABI(sw3abi.SimpleSwapFactoryABIv0_4_0) + factoryABI = abiutil.MustParseABI(sw3abi.SimpleSwapFactoryABIv0_5_4) simpleSwapDeployedEventType = factoryABI.Events["SimpleSwapDeployed"] ) @@ -54,12 +54,11 @@ type simpleSwapDeployedEvent struct { } // the bytecode of factories which can be used for deployment -var currentDeployVersion []byte = common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_4_0) +var currentDeployVersion = common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_5_4) // the bytecode of factories from which we accept chequebooks var supportedVersions = [][]byte{ currentDeployVersion, - common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_3_1), } // NewFactory creates a new factory service for the provided factory contract. diff --git a/pkg/settlement/swap/chequebook/factory_test.go b/pkg/settlement/swap/chequebook/factory_test.go index 0f65f3f0e4c..6e068424ebb 100644 --- a/pkg/settlement/swap/chequebook/factory_test.go +++ b/pkg/settlement/swap/chequebook/factory_test.go @@ -22,7 +22,7 @@ import ( ) var ( - factoryABI = abiutil.MustParseABI(sw3abi.SimpleSwapFactoryABIv0_4_0) + factoryABI = abiutil.MustParseABI(sw3abi.SimpleSwapFactoryABIv0_5_4) simpleSwapDeployedEvent = factoryABI.Events["SimpleSwapDeployed"] ) @@ -82,9 +82,9 @@ func TestFactoryVerifySelf(t *testing.T) { factory := chequebook.NewFactory( backendWithCodeAt(map[common.Address]string{ - factoryAddress: sw3abi.SimpleSwapFactoryDeployedBinv0_4_0, - legacyFactory1: sw3abi.SimpleSwapFactoryDeployedBinv0_3_1, - legacyFactory2: sw3abi.SimpleSwapFactoryDeployedBinv0_3_1, + factoryAddress: sw3abi.SimpleSwapFactoryDeployedBinv0_5_4, + legacyFactory1: sw3abi.SimpleSwapFactoryDeployedBinv0_5_4, + legacyFactory2: sw3abi.SimpleSwapFactoryDeployedBinv0_5_4, }), transactionmock.New(), factoryAddress, @@ -123,8 +123,8 @@ func TestFactoryVerifySelf(t *testing.T) { factory := chequebook.NewFactory( backendWithCodeAt(map[common.Address]string{ - factoryAddress: sw3abi.SimpleSwapFactoryDeployedBinv0_4_0, - legacyFactory1: sw3abi.SimpleSwapFactoryDeployedBinv0_3_1, + factoryAddress: sw3abi.SimpleSwapFactoryDeployedBinv0_5_4, + legacyFactory1: sw3abi.SimpleSwapFactoryDeployedBinv0_5_4, legacyFactory2: "abcd", }), transactionmock.New(), diff --git a/pkg/settlement/swap/erc20/erc20.go b/pkg/settlement/swap/erc20/erc20.go index c7b76a424ae..9d6b73dc4da 100644 --- a/pkg/settlement/swap/erc20/erc20.go +++ b/pkg/settlement/swap/erc20/erc20.go @@ -18,7 +18,7 @@ import ( ) var ( - erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_3_1) + erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_5_4) errDecodeABI = errors.New("could not decode abi data") ) diff --git a/pkg/settlement/swap/erc20/erc20_test.go b/pkg/settlement/swap/erc20/erc20_test.go index 56287aab5c1..6e4ce1bd627 100644 --- a/pkg/settlement/swap/erc20/erc20_test.go +++ b/pkg/settlement/swap/erc20/erc20_test.go @@ -17,7 +17,7 @@ import ( ) var ( - erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_3_1) + erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_5_4) ) func TestBalanceOf(t *testing.T) { diff --git a/pkg/settlement/swap/priceoracle/priceoracle.go b/pkg/settlement/swap/priceoracle/priceoracle.go index f67dcd90083..06ab07d5e6c 100644 --- a/pkg/settlement/swap/priceoracle/priceoracle.go +++ b/pkg/settlement/swap/priceoracle/priceoracle.go @@ -47,7 +47,7 @@ type Service interface { } var ( - priceOracleABI = abiutil.MustParseABI(priceoracleabi.PriceOracleABIv0_1_0) + priceOracleABI = abiutil.MustParseABI(priceoracleabi.PriceOracleABIv0_2_0) ) func New(logger log.Logger, priceOracleAddress common.Address, transactionService transaction.Service, timeDivisor int64) Service { diff --git a/pkg/settlement/swap/priceoracle/priceoracle_test.go b/pkg/settlement/swap/priceoracle/priceoracle_test.go index 720220ad099..2404d991058 100644 --- a/pkg/settlement/swap/priceoracle/priceoracle_test.go +++ b/pkg/settlement/swap/priceoracle/priceoracle_test.go @@ -18,7 +18,7 @@ import ( ) var ( - priceOracleABI = abiutil.MustParseABI(priceoracleabi.PriceOracleABIv0_1_0) + priceOracleABI = abiutil.MustParseABI(priceoracleabi.PriceOracleABIv0_2_0) ) func TestExchangeGetPrice(t *testing.T) { diff --git a/pkg/storageincentives/staking/contract.go b/pkg/storageincentives/staking/contract.go index 014b1a67adc..78f8857dac3 100644 --- a/pkg/storageincentives/staking/contract.go +++ b/pkg/storageincentives/staking/contract.go @@ -23,7 +23,7 @@ import ( var ( MinimumStakeAmount = big.NewInt(100000000000000000) - erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_3_1) + erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_5_4) ErrInsufficientStakeAmount = errors.New("insufficient stake amount") ErrInsufficientFunds = errors.New("insufficient token balance") diff --git a/pkg/transaction/event_test.go b/pkg/transaction/event_test.go index 5e06317021f..cb51b4e0beb 100644 --- a/pkg/transaction/event_test.go +++ b/pkg/transaction/event_test.go @@ -17,7 +17,7 @@ import ( ) var ( - erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_3_1) + erc20ABI = abiutil.MustParseABI(sw3abi.ERC20ABIv0_5_4) ) type transferEvent struct {