diff --git a/.github/setup_template.sh b/.github/setup_template.sh index 498e4b5d6..489b3f7e9 100644 --- a/.github/setup_template.sh +++ b/.github/setup_template.sh @@ -87,7 +87,6 @@ if ! unzip -h >/dev/null 2>&1; then fi # Ask for parameters. -ask "Select a network [1: mainnet, 2: testnet]" NETWORK 1 ask "Enter the binary installation path" INSTALL_PATH "/usr/local/bin/geth" ask "Enter the os user name of systemd service" SERVICE_USER "geth" ask "Enter the passphrase for the private key" PASSPHRASE "" "-s" @@ -109,22 +108,9 @@ if [ -z "$PASSPHRASE" ]; then exit 1 fi -case "$NETWORK" in - 1) - NETWORK=mainnet - NETWORK_ID=248 - BOOTNODES="enode://1e68361cb0e761e0789c014acdbd2491f30176acf25480408382916632e58af1711d857c75be5917319d06049937e49c09ca51a28590e6ee22aceca1161fd583@3.113.207.39:30301,enode://24a55fd923d780213d15f5551bcbb7171343ef095512927d91baca3e7917124c679f894282eefec37350088b31c45a49bb28df790eb88f487ad60a9b6ccc8f3b@35.238.159.190:30301" - ;; - 2) - NETWORK=testnet - NETWORK_ID=9372 - BOOTNODES="enode://4a85df39ec500acd31d4b9feeea1d024afee5e8df4bc29325c2abf2e0a02a34f6ece24aca06cb5027675c167ecf95a9fc23fb7a0f671f84edb07dafe6e729856@34.142.254.12:30301" - ;; - *) - msg_err "Select 1 or 2 for the network." - exit 1 -esac - +NETWORK=mainnet +NETWORK_ID=248 +BOOTNODES="enode://1e68361cb0e761e0789c014acdbd2491f30176acf25480408382916632e58af1711d857c75be5917319d06049937e49c09ca51a28590e6ee22aceca1161fd583@3.113.207.39:30301,enode://24a55fd923d780213d15f5551bcbb7171343ef095512927d91baca3e7917124c679f894282eefec37350088b31c45a49bb28df790eb88f487ad60a9b6ccc8f3b@35.238.159.190:30301" HOME_DIR=/home/$SERVICE_USER WALLET_FILE=$HOME_DIR/.ethereum/wallet.txt PASSWORD_FILE=$HOME_DIR/.ethereum/password.txt diff --git a/.gitmodules b/.gitmodules index d06a1d126..a243561ba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,5 +7,8 @@ url = https://github.com/ipsilon/evm-benchmarks shallow = true [submodule "consensus/oasys/oasys-genesis-contract"] - path = consensus/oasys/oasys-genesis-contract + path = consensus/oasys/oasys-genesis-contract-cfb3cd0 + url = https://github.com/oasysgames/oasys-genesis-contract.git +[submodule "oasys-genesis-contract-6037082"] + path = consensus/oasys/oasys-genesis-contract-6037082 url = https://github.com/oasysgames/oasys-genesis-contract.git diff --git a/consensus/oasys/contract.go b/consensus/oasys/contract.go index bb25d2b7f..098165db2 100644 --- a/consensus/oasys/contract.go +++ b/consensus/oasys/contract.go @@ -10,6 +10,7 @@ import ( "fmt" "math" "math/big" + "path/filepath" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts" @@ -29,52 +30,65 @@ import ( const ( // Oasys genesis contracts - environmentAddress = "0x0000000000000000000000000000000000001000" - stakeManagerAddress = "0x0000000000000000000000000000000000001001" - allowListAddress = "0x0000000000000000000000000000000000001002" + environmentAddress = "0x0000000000000000000000000000000000001000" + stakeManagerAddress = "0x0000000000000000000000000000000000001001" + allowListAddress = "0x0000000000000000000000000000000000001002" + candidateManagerAddress = "0x520000000000000000000000000000000000002e" ) var ( - //go:embed oasys-genesis-contract/artifacts/contracts/Environment.sol/Environment.json - //go:embed oasys-genesis-contract/artifacts/contracts/StakeManager.sol/StakeManager.json + //go:embed oasys-genesis-contract-cfb3cd0/artifacts/contracts/Environment.sol/Environment.json + //go:embed oasys-genesis-contract-cfb3cd0/artifacts/contracts/StakeManager.sol/StakeManager.json + //go:embed oasys-genesis-contract-6037082/artifacts/contracts/CandidateValidatorManager.sol/CandidateValidatorManager.json artifacts embed.FS // Oasys genesis contracts - environment = &systemContract{ + environment = &genesisContract{ address: common.HexToAddress(environmentAddress), artifact: &artifact{ - path: "oasys-genesis-contract/artifacts/contracts/Environment.sol/Environment.json", + path: filepath.FromSlash("oasys-genesis-contract-cfb3cd0/artifacts/contracts/Environment.sol/Environment.json"), }, } - stakeManager = &systemContract{ + stakeManager = &genesisContract{ address: common.HexToAddress(stakeManagerAddress), artifact: &artifact{ - path: "oasys-genesis-contract/artifacts/contracts/StakeManager.sol/StakeManager.json", + path: filepath.FromSlash("oasys-genesis-contract-cfb3cd0/artifacts/contracts/StakeManager.sol/StakeManager.json"), }, } - genesisContracts = map[common.Address]bool{ - environment.address: true, - stakeManager.address: true, + systemMethods = map[*genesisContract]map[string]int{ + // Methods with the `onlyCoinbase` modifier are system methods. + // See: https://github.com/oasysgames/oasys-genesis-contract/search?q=onlyCoinbase + environment: {"initialize": 0, "updateValue": 0}, + stakeManager: {"initialize": 0, "slash": 0}, + } + + candidateManager = &builtinContract{ + address: common.HexToAddress(candidateManagerAddress), + artifact: &artifact{ + path: filepath.FromSlash("oasys-genesis-contract-6037082/artifacts/contracts/CandidateValidatorManager.sol/CandidateValidatorManager.json"), + }, } ) func init() { // Parse the system contract ABI - contracts := []*systemContract{environment, stakeManager} - for _, contract := range contracts { - rawData, err := artifacts.ReadFile(contract.artifact.path) - if err != nil { - panic(err) - } - if err = json.Unmarshal(rawData, contract.artifact); err != nil { - panic(err) - } + if err := environment.parseABI(); err != nil { + panic(err) + } + if err := stakeManager.parseABI(); err != nil { + panic(err) + } + if err := candidateManager.parseABI(); err != nil { + panic(err) + } - ABI, err := abi.JSON(bytes.NewReader(contract.artifact.Abi)) - if err != nil { - panic(err) + // Check if the ABI includes system methods + for contract, methods := range systemMethods { + for method := range methods { + if _, ok := contract.abi.Methods[method]; !ok { + panic(fmt.Sprintf("Method `%s` does not exist", method)) + } } - contract.abi = &ABI } } @@ -85,19 +99,43 @@ type artifact struct { DeployedBytecode string `json:"deployedBytecode"` } -// systemContract -type systemContract struct { +// contract +type contract struct { address common.Address abi *abi.ABI artifact *artifact } -func (s *systemContract) verifyCode(state *state.StateDB) bool { - deployed := state.GetCode(s.address) - expect := common.FromHex(s.artifact.DeployedBytecode) +func (b *contract) parseABI() error { + rawData, err := artifacts.ReadFile(b.artifact.path) + if err != nil { + return err + } + if err = json.Unmarshal(rawData, b.artifact); err != nil { + return err + } + + ABI, err := abi.JSON(bytes.NewReader(b.artifact.Abi)) + if err != nil { + return err + } + b.abi = &ABI + + return nil +} + +// Contracts deployed in the genesis block +type genesisContract = contract + +func (g *genesisContract) verifyCode(state *state.StateDB) bool { + deployed := state.GetCode(g.address) + expect := common.FromHex(g.artifact.DeployedBytecode) return bytes.Equal(deployed, expect) } +// Contracts deployed in a hard fork. +type builtinContract = contract + // chainContext type chainContext struct { Chain consensus.ChainHeaderReader @@ -160,15 +198,15 @@ func (p *environmentValue) Copy() *environmentValue { } } -// getNextValidatorsResult -type getNextValidatorsResult struct { +// nextValidators +type nextValidators struct { Owners []common.Address Operators []common.Address Stakes []*big.Int } -func (p *getNextValidatorsResult) Copy() *getNextValidatorsResult { - cpy := getNextValidatorsResult{ +func (p *nextValidators) Copy() *nextValidators { + cpy := nextValidators{ Owners: make([]common.Address, len(p.Owners)), Operators: make([]common.Address, len(p.Operators)), Stakes: make([]*big.Int, len(p.Stakes)), @@ -181,7 +219,7 @@ func (p *getNextValidatorsResult) Copy() *getNextValidatorsResult { return &cpy } -func (p *getNextValidatorsResult) Exists(validator common.Address) bool { +func (p *nextValidators) Exists(validator common.Address) bool { for _, operator := range p.Operators { if validator == operator { return true @@ -219,20 +257,37 @@ func (m callmsg) Value() *big.Int { return m.CallMsg.Value } func (m callmsg) Data() []byte { return m.CallMsg.Data } func (c *Oasys) IsSystemTransaction(tx *types.Transaction, header *types.Header) (bool, error) { + // deploy transaction if tx.To() == nil { return false, nil } - sender, err := types.Sender(c.txSigner, tx) - if err != nil { + + if sender, err := types.Sender(c.txSigner, tx); err != nil { return false, errors.New("unauthorized transaction") + } else if sender != header.Coinbase { + // not created by validator + return false, nil } - if sender == header.Coinbase && genesisContracts[*tx.To()] && tx.GasPrice().Cmp(common.Big0) == 0 { - return true, nil + + for contract, methods := range systemMethods { + if contract.address != *tx.To() { + continue + } + + if called, err := contract.abi.MethodById(tx.Data()); err != nil { + return false, nil + } else if _, ok := methods[called.RawName]; ok { + log.Info("System method transacted", + "validator", header.Coinbase.Hex(), "tx", tx.Hash().Hex(), + "contract", contract.address.Hex(), "method", called.RawName) + return true, nil + } } + return false, nil } -// update functions +// Transact the `Environment.initialize` and `StakeManager.initialize` method. func (c *Oasys) initializeSystemContracts( state *state.StateDB, header *types.Header, @@ -274,6 +329,7 @@ func (c *Oasys) initializeSystemContracts( return nil } +// Transact the `StakeManager.slash` method. func (c *Oasys) slash( validator common.Address, schedule map[uint64]common.Address, @@ -305,16 +361,30 @@ type blockchainAPI interface { } // view functions -func getNextValidators(ethAPI blockchainAPI, hash common.Hash, epoch uint64) (*getNextValidatorsResult, error) { +func getNextValidators( + config *params.ChainConfig, + ethAPI blockchainAPI, + hash common.Hash, + epoch uint64, + block uint64, +) (*nextValidators, error) { + if config.IsForkedOasysPublication(new(big.Int).SetUint64(block)) { + return callGetHighStakes(ethAPI, hash, epoch) + } + return callGetValidators(ethAPI, hash, epoch) +} + +// Call the `StakeManager.getValidators` method. +func callGetValidators(ethAPI blockchainAPI, hash common.Hash, epoch uint64) (*nextValidators, error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() var ( method = "getValidators" - result getNextValidatorsResult - bepoch = big.NewInt(int64(epoch)) + result nextValidators + bepoch = new(big.Int).SetUint64(epoch) cursor = big.NewInt(0) - howMany = big.NewInt(200) + howMany = big.NewInt(100) ) for { data, err := stakeManager.abi.Pack(method, bepoch, cursor, howMany) @@ -361,6 +431,67 @@ func getNextValidators(ethAPI blockchainAPI, hash common.Hash, epoch uint64) (*g return &result, nil } +// Call the `CandidateValidatorManager.getHighStakes` method. +func callGetHighStakes(ethAPI blockchainAPI, hash common.Hash, epoch uint64) (*nextValidators, error) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + var ( + method = "getHighStakes" + result nextValidators + bpoch = new(big.Int).SetUint64(epoch) + cursor = big.NewInt(0) + howMany = big.NewInt(100) + ) + for { + data, err := candidateManager.abi.Pack(method, bpoch, cursor, howMany) + if err != nil { + return nil, err + } + + hexData := (hexutil.Bytes)(data) + rbytes, err := ethAPI.Call( + ctx, + ethapi.TransactionArgs{ + To: &candidateManager.address, + Data: &hexData, + }, + rpc.BlockNumberOrHashWithHash(hash, false), + nil) + if err != nil { + return nil, err + } + + var recv struct { + Owners []common.Address + Operators []common.Address + Stakes []*big.Int + Candidates []bool + NewCursor *big.Int + + // unused + Actives, Jailed []bool + } + if err := candidateManager.abi.UnpackIntoInterface(&recv, method, rbytes); err != nil { + return nil, err + } else if len(recv.Owners) == 0 { + break + } + + cursor = recv.NewCursor + for i := range recv.Owners { + if recv.Candidates[i] { + result.Owners = append(result.Owners, recv.Owners[i]) + result.Operators = append(result.Operators, recv.Operators[i]) + result.Stakes = append(result.Stakes, recv.Stakes[i]) + } + } + } + + return &result, nil +} + +// Call the `StakeManager.getValidatorOwners` method. func getValidatorOwners(ethAPI blockchainAPI, hash common.Hash) ([]common.Address, error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -369,7 +500,7 @@ func getValidatorOwners(ethAPI blockchainAPI, hash common.Hash) ([]common.Addres method = "getValidatorOwners" result []common.Address cursor = big.NewInt(0) - howMany = big.NewInt(200) + howMany = big.NewInt(100) ) for { data, err := stakeManager.abi.Pack(method, cursor, howMany) @@ -407,6 +538,7 @@ func getValidatorOwners(ethAPI blockchainAPI, hash common.Hash) ([]common.Addres return result, nil } +// Call the `StakeManager.getTotalRewards` method. func getRewards(ethAPI blockchainAPI, hash common.Hash) (*big.Int, error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -465,6 +597,7 @@ func getRewards(ethAPI blockchainAPI, hash common.Hash) (*big.Int, error) { return result, nil } +// Call the `Environment.nextValue` method. func getNextEnvironmentValue(ethAPI blockchainAPI, hash common.Hash) (*environmentValue, error) { method := "nextValue" diff --git a/consensus/oasys/contract_test.go b/consensus/oasys/contract_test.go index e185bd6e7..803a36ee3 100644 --- a/consensus/oasys/contract_test.go +++ b/consensus/oasys/contract_test.go @@ -162,12 +162,25 @@ func TestGetNextValidators(t *testing.T) { uint256ArrTy, _ := abi.NewType("uint256[]", "", nil) boolArrTy, _ := abi.NewType("bool[]", "", nil) uint256Ty, _ := abi.NewType("uint256", "", nil) - arguments := abi.Arguments{ - {Type: addressArrTy}, - {Type: addressArrTy}, - {Type: uint256ArrTy}, - {Type: boolArrTy}, - {Type: uint256Ty}, + + // Return value of the `StakeManager.getValidators` method. + returnTy1 := abi.Arguments{ + {Type: addressArrTy}, // owners + {Type: addressArrTy}, // operators + {Type: uint256ArrTy}, // stakes + {Type: boolArrTy}, // candidates + {Type: uint256Ty}, // newCursor + } + + // Return value of the `CandidateValidatorManager.getHighStakes` method. + returnTy2 := abi.Arguments{ + {Type: addressArrTy}, // owners + {Type: addressArrTy}, // operators + {Type: boolArrTy}, // actives + {Type: boolArrTy}, // jailed + {Type: uint256ArrTy}, // stakes + {Type: boolArrTy}, // candidates + {Type: uint256Ty}, // newCursor } var ( @@ -188,14 +201,21 @@ func TestGetNextValidators(t *testing.T) { } ) var ( - rbytes = make([][]byte, 7) + // rbytes = make([][]byte, 7) + page = 7 howMany = 100 newCursor = howMany + rbytes = map[common.Address][][]byte{ + stakeManager.address: make([][]byte, page), + candidateManager.address: make([][]byte, page), + } ) - for i := 0; i < len(rbytes); i++ { + for i := 0; i < page; i++ { var ( owners = make([]common.Address, howMany) operators = make([]common.Address, howMany) + actives = make([]bool, howMany) + jailed = make([]bool, howMany) stakes = make([]*big.Int, howMany) candidates = make([]bool, howMany) ) @@ -204,55 +224,73 @@ func TestGetNextValidators(t *testing.T) { idx := i / len(wantOwners) owners[j] = wantOwners[idx] operators[j] = wantOperators[idx] + actives[j] = true + jailed[j] = false stakes[j] = wantStakes[idx] candidates[j] = true } else { owners[j] = common.Address{} operators[j] = common.Address{} + actives[j] = true + jailed[j] = false stakes[j] = big.NewInt(0) candidates[j] = false } } - rbyte, _ := arguments.Pack(owners, operators, stakes, candidates, big.NewInt(int64(newCursor))) - rbytes[i] = rbyte + bnewCursor := big.NewInt(int64(newCursor)) + + rbyte, _ := returnTy1.Pack(owners, operators, stakes, candidates, bnewCursor) + rbytes[stakeManager.address][i] = rbyte + + rbyte, _ = returnTy2.Pack(owners, operators, actives, jailed, stakes, candidates, bnewCursor) + rbytes[candidateManager.address][i] = rbyte + + if i == page-1 { + rbyte, _ := returnTy1.Pack([]common.Address{}, []common.Address{}, []*big.Int{}, []bool{}, bnewCursor) + rbytes[stakeManager.address] = append(rbytes[stakeManager.address], rbyte) + + rbyte, _ = returnTy2.Pack([]common.Address{}, []common.Address{}, []bool{}, []bool{}, []*big.Int{}, []bool{}, bnewCursor) + rbytes[candidateManager.address] = append(rbytes[candidateManager.address], rbyte) - if i == len(rbytes)-1 { - rbyte, _ := arguments.Pack([]common.Address{}, []common.Address{}, []*big.Int{}, []bool{}, big.NewInt(int64(newCursor))) - rbytes = append(rbytes, rbyte) break } newCursor += howMany } + config := ¶ms.ChainConfig{ChainID: big.NewInt(999999), Oasys: ¶ms.OasysConfig{}} ethapi := &testBlockchainAPI{rbytes: rbytes} - got, _ := getNextValidators(ethapi, common.Hash{}, 1) - if len(got.Owners) != len(wantOwners) { - t.Errorf("invalid owners length, got: %d, want: %d", len(got.Owners), len(wantOwners)) - } - if len(got.Operators) != len(wantOperators) { - t.Errorf("invalid operators length, got: %d, want: %d", len(got.Operators), len(wantOperators)) - } - if len(got.Stakes) != len(wantStakes) { - t.Errorf("invalid stakes length, got: %d, want: %d", len(got.Stakes), len(wantStakes)) - } - for i, want := range wantOwners { - got := got.Owners[i] - if got != want { - t.Errorf("invalid owner, got %v, want: %v", got, want) + + for _, block := range []uint64{1, 10} { + got, _ := getNextValidators(config, ethapi, common.Hash{}, 1, block) + + if len(got.Owners) != len(wantOwners) { + t.Errorf("invalid owners length, got: %d, want: %d", len(got.Owners), len(wantOwners)) } - } - for i, want := range wantOperators { - got := got.Operators[i] - if got != want { - t.Errorf("invalid operator, got %v, want: %v", got, want) + if len(got.Operators) != len(wantOperators) { + t.Errorf("invalid operators length, got: %d, want: %d", len(got.Operators), len(wantOperators)) } - } - for i, want := range wantStakes { - got := got.Stakes[i] - if got.Cmp(want) != 0 { - t.Errorf("invalid stake, got %v, want: %v", got, want) + if len(got.Stakes) != len(wantStakes) { + t.Errorf("invalid stakes length, got: %d, want: %d", len(got.Stakes), len(wantStakes)) + } + for i, want := range wantOwners { + got := got.Owners[i] + if got != want { + t.Errorf("invalid owner, got %v, want: %v", got, want) + } + } + for i, want := range wantOperators { + got := got.Operators[i] + if got != want { + t.Errorf("invalid operator, got %v, want: %v", got, want) + } + } + for i, want := range wantStakes { + got := got.Stakes[i] + if got.Cmp(want) != 0 { + t.Errorf("invalid stake, got %v, want: %v", got, want) + } } } } @@ -273,7 +311,7 @@ func TestGetRewards(t *testing.T) { rbyte, _ = abi.Arguments{{Type: uint256Ty}}.Pack(want) rbytes[1] = rbyte - ethapi := &testBlockchainAPI{rbytes: rbytes} + ethapi := &testBlockchainAPI{rbytes: map[common.Address][][]byte{stakeManager.address: rbytes}} got, _ := getRewards(ethapi, common.Hash{}) if got.Cmp(want) != 0 { t.Errorf("got %v, want: %v", got, want) @@ -318,7 +356,7 @@ func TestGetNextEnvironmentValue(t *testing.T) { want.JailPeriod, ) - ethapi := &testBlockchainAPI{rbytes: [][]byte{rbyte}} + ethapi := &testBlockchainAPI{rbytes: map[common.Address][][]byte{environment.address: {rbyte}}} got, _ := getNextEnvironmentValue(ethapi, common.Hash{}) if got.StartBlock.Cmp(want.StartBlock) != 0 { @@ -359,13 +397,18 @@ func TestGetNextEnvironmentValue(t *testing.T) { } type testBlockchainAPI struct { - rbytes [][]byte - count int + rbytes map[common.Address][][]byte + count map[common.Address]int } func (p *testBlockchainAPI) Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi.StateOverride) (hexutil.Bytes, error) { - defer func() { p.count++ }() - return p.rbytes[p.count], nil + if p.count == nil { + p.count = map[common.Address]int{} + } + + to := *args.To + defer func() { p.count[to]++ }() + return p.rbytes[to][p.count[to]], nil } type testEnv struct { diff --git a/consensus/oasys/oasys-genesis-contract-6037082 b/consensus/oasys/oasys-genesis-contract-6037082 new file mode 160000 index 000000000..60370825c --- /dev/null +++ b/consensus/oasys/oasys-genesis-contract-6037082 @@ -0,0 +1 @@ +Subproject commit 60370825ca0df697a6180a2cf48c5bdb67dea609 diff --git a/consensus/oasys/oasys-genesis-contract b/consensus/oasys/oasys-genesis-contract-cfb3cd0 similarity index 100% rename from consensus/oasys/oasys-genesis-contract rename to consensus/oasys/oasys-genesis-contract-cfb3cd0 diff --git a/consensus/oasys/oasys.go b/consensus/oasys/oasys.go index 6bf7aad95..01fd42172 100644 --- a/consensus/oasys/oasys.go +++ b/consensus/oasys/oasys.go @@ -78,10 +78,17 @@ var ( // invalid list of validators (i.e. non divisible by 20 bytes). errInvalidCheckpointValidators = errors.New("invalid validator list on checkpoint block") + // errInvalidEpochHash is returned if a epoch block contains an invalid Keccak256 hash. + errInvalidEpochHash = errors.New("invalid hash on epoch block") + // errMismatchingEpochValidators is returned if a checkpoint block contains a // list of validators different than the one the local node calculated. errMismatchingEpochValidators = errors.New("mismatching validator list on checkpoint block") + // errMismatchingEpochHash is returned if a epoch block contains a + // Keccak256 hash different than the one the local node calculated. + errMismatchingEpochHash = errors.New("mismatching hash of validator list on epoch block") + // errInvalidMixDigest is returned if a block's mix digest is non-zero. errInvalidMixDigest = errors.New("non-zero mix digest") @@ -240,14 +247,14 @@ func (c *Oasys) verifyHeader(chain consensus.ChainHeaderReader, header *types.He if err != nil { return err } - isEpoch := env.IsEpoch(number) validatorBytes := len(header.Extra) - extraVanity - extraSeal - if !isEpoch && validatorBytes != 0 { + if env.IsEpoch(number) { + if err := c.verifyExtraHeaderLengthInEpoch(header.Number, validatorBytes); err != nil { + return err + } + } else if validatorBytes != 0 { return errExtraSigners } - if isEpoch && validatorBytes%common.AddressLength != 0 { - return errInvalidCheckpointValidators - } // Ensure that the mix digest is zero as we don't have fork protection currently if header.MixDigest != (common.Hash{}) { return errInvalidMixDigest @@ -301,7 +308,7 @@ func (c *Oasys) verifyCascadingFields(chain consensus.ChainHeaderReader, header } var backoff uint64 if number > 0 && env.IsEpoch(number) { - result, err := getNextValidators(c.ethAPI, header.ParentHash, env.Epoch(number)) + result, err := getNextValidators(c.chainConfig, c.ethAPI, header.ParentHash, env.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "verifyCascadingFields", "hash", header.ParentHash, "number", number, "err", err) return err @@ -355,7 +362,7 @@ func (c *Oasys) snapshot(chain consensus.ChainHeaderReader, number uint64, hash } // If an on-disk checkpoint snapshot can be found, use that if number%checkpointInterval == 0 { - if s, err := loadSnapshot(c.config, c.signatures, c.ethAPI, c.db, hash); err == nil { + if s, err := loadSnapshot(c.chainConfig, c.signatures, c.ethAPI, c.db, hash); err == nil { log.Trace("Loaded snapshot from disk", "number", number, "hash", hash) snap = s break @@ -376,7 +383,7 @@ func (c *Oasys) snapshot(chain consensus.ChainHeaderReader, number uint64, hash return nil, err } - snap = newSnapshot(c.config, c.signatures, c.ethAPI, number, hash, validators, getInitialEnvironment(c.config)) + snap = newSnapshot(c.chainConfig, c.signatures, c.ethAPI, number, hash, validators, getInitialEnvironment(c.config)) if err := snap.store(c.db); err != nil { return nil, err } @@ -465,7 +472,7 @@ func (c *Oasys) verifySeal(chain consensus.ChainHeaderReader, header *types.Head schedule map[uint64]common.Address ) if number > 0 && env.IsEpoch(number) { - result, err := getNextValidators(c.ethAPI, header.ParentHash, env.Epoch(number)) + result, err := getNextValidators(c.chainConfig, c.ethAPI, header.ParentHash, env.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "verifySeal", "hash", header.ParentHash, "number", number, "err", err) return err @@ -523,18 +530,13 @@ func (c *Oasys) Prepare(chain consensus.ChainHeaderReader, header *types.Header) schedule map[uint64]common.Address ) if number > 0 && env.IsEpoch(number) { - result, err := getNextValidators(c.ethAPI, header.ParentHash, env.Epoch(number)) + result, err := getNextValidators(c.chainConfig, c.ethAPI, header.ParentHash, env.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "Prepare", "hash", header.ParentHash, "number", number, "err", err) return err } - newValidators := result.Copy().Operators - sort.Sort(validatorsAscending(newValidators)) - for _, validator := range newValidators { - header.Extra = append(header.Extra, validator[:]...) - } - + header.Extra = append(header.Extra, c.getExtraHeaderValueInEpoch(header.Number, result.Operators)...) backoff = c.backOffTime(chain, result, env, number, c.signer) schedule = c.getValidatorSchedule(chain, result, env, number) } else { @@ -598,11 +600,12 @@ func (c *Oasys) Finalize(chain consensus.ChainHeaderReader, header *types.Header } var ( + isEpoch = env.IsEpoch(number) schedule map[uint64]common.Address - nextValidators *getNextValidatorsResult + nextValidators *nextValidators ) - if env.IsEpoch(number) { - nextValidators, err = getNextValidators(c.ethAPI, header.ParentHash, env.Epoch(number)) + if isEpoch { + nextValidators, err = getNextValidators(c.chainConfig, c.ethAPI, header.ParentHash, env.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "Finalize", "hash", header.ParentHash, "number", number, "err", err) return err @@ -621,21 +624,15 @@ func (c *Oasys) Finalize(chain consensus.ChainHeaderReader, header *types.Header return err } - if number >= c.config.Epoch && header.Difficulty.Cmp(diffInTurn) != 0 { - if env.IsEpoch(number) { - // If the block is a checkpoint block, verify the validator list - newValidators := nextValidators.Copy().Operators - sort.Sort(validatorsAscending(newValidators)) - validatorsBytes := make([]byte, len(newValidators)*common.AddressLength) - for i, validator := range newValidators { - copy(validatorsBytes[i*common.AddressLength:], validator.Bytes()) - } - extraSuffix := len(header.Extra) - extraSeal - if !bytes.Equal(header.Extra[extraVanity:extraSuffix], validatorsBytes) { - return errMismatchingEpochValidators - } + if isEpoch { + // If the block is a epoch block, verify the validator list or hash + actual := header.Extra[extraVanity : len(header.Extra)-extraSeal] + if err := c.verifyExtraHeaderValueInEpoch(header.Number, actual, nextValidators.Operators); err != nil { + return err } + } + if number >= c.config.Epoch && header.Difficulty.Cmp(diffInTurn) != 0 { validator, err := ecrecover(header, c.signatures) if err != nil { return err @@ -688,7 +685,7 @@ func (c *Oasys) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *t var schedule map[uint64]common.Address if env.IsEpoch(number) { - nextValidators, err := getNextValidators(c.ethAPI, header.ParentHash, env.Epoch(number)) + nextValidators, err := getNextValidators(c.chainConfig, c.ethAPI, header.ParentHash, env.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "FinalizeAndAssemble", "hash", header.ParentHash, "number", number, "err", err) return nil, nil, err @@ -763,7 +760,7 @@ func (c *Oasys) Seal(chain consensus.ChainHeaderReader, block *types.Block, resu // Bail out if we're unauthorized to sign a block var exists bool if number > 0 && env.IsEpoch(number) { - result, err := getNextValidators(c.ethAPI, header.ParentHash, env.Epoch(number)) + result, err := getNextValidators(c.chainConfig, c.ethAPI, header.ParentHash, env.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "Seal", "hash", header.ParentHash, "number", number, "err", err) return err @@ -820,7 +817,7 @@ func (c *Oasys) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, p var schedule map[uint64]common.Address if env.IsEpoch(number) { - result, err := getNextValidators(c.ethAPI, parent.Hash(), env.Epoch(number)) + result, err := getNextValidators(c.chainConfig, c.ethAPI, parent.Hash(), env.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "Seal", "hash", parent.Hash(), "number", number, "err", err) return nil @@ -861,6 +858,53 @@ func (c *Oasys) APIs(chain consensus.ChainHeaderReader) []rpc.API { }} } +// Converting the validator list for the extra header field. +func (c *Oasys) getExtraHeaderValueInEpoch(number *big.Int, validators []common.Address) []byte { + cpy := make([]common.Address, len(validators)) + copy(cpy, validators) + + forked := c.chainConfig.IsForkedOasysPublication(number) + if !forked { + sort.Sort(validatorsAscending(cpy)) + } + + extra := make([]byte, len(cpy)*common.AddressLength) + for i, v := range cpy { + copy(extra[i*common.AddressLength:], v.Bytes()) + } + + // Convert to hash because there may be many validators. + if forked { + extra = crypto.Keccak256(extra) + } + return extra +} + +// Verify the length of the Extra header field. +func (c *Oasys) verifyExtraHeaderLengthInEpoch(number *big.Int, length int) error { + if c.chainConfig.IsForkedOasysPublication(number) { + if length != crypto.DigestLength { + return errInvalidEpochHash + } + } else if length%common.AddressLength != 0 { + return errInvalidCheckpointValidators + } + return nil +} + +// Verify the value of the Extra header field. +func (c *Oasys) verifyExtraHeaderValueInEpoch(number *big.Int, actual []byte, validators []common.Address) error { + expect := c.getExtraHeaderValueInEpoch(number, validators) + if bytes.Equal(actual, expect) { + return nil + } + + if c.chainConfig.IsForkedOasysPublication(number) { + return errMismatchingEpochHash + } + return errMismatchingEpochValidators +} + // SealHash returns the hash of a block prior to it being sealed. func SealHash(header *types.Header) (hash common.Hash) { hasher := sha3.NewLegacyKeccak256() @@ -931,11 +975,11 @@ func (c *Oasys) addBalanceToStakeManager(state *state.StateDB, hash common.Hash, return nil } -func (c *Oasys) getValidatorSchedule(chain consensus.ChainHeaderReader, result *getNextValidatorsResult, env *environmentValue, number uint64) map[uint64]common.Address { +func (c *Oasys) getValidatorSchedule(chain consensus.ChainHeaderReader, result *nextValidators, env *environmentValue, number uint64) map[uint64]common.Address { return getValidatorSchedule(chain, result.Operators, result.Stakes, env, number) } -func (c *Oasys) backOffTime(chain consensus.ChainHeaderReader, result *getNextValidatorsResult, +func (c *Oasys) backOffTime(chain consensus.ChainHeaderReader, result *nextValidators, env *environmentValue, number uint64, validator common.Address) uint64 { if !result.Exists(validator) { return 0 diff --git a/consensus/oasys/snapshot.go b/consensus/oasys/snapshot.go index f9065458e..f19ebd1e0 100644 --- a/consensus/oasys/snapshot.go +++ b/consensus/oasys/snapshot.go @@ -19,7 +19,7 @@ import ( // Snapshot is the state of the authorization voting at a given point in time. type Snapshot struct { - config *params.OasysConfig // Consensus engine parameters to fine tune behavior + config *params.ChainConfig // Consensus engine parameters to fine tune behavior sigcache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover ethAPI *ethapi.PublicBlockChainAPI @@ -40,7 +40,7 @@ func (s validatorsAscending) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // newSnapshot creates a new snapshot with the specified startup parameters. This // method does not initialize the set of recent validators, so only ever use if for // the genesis block. -func newSnapshot(config *params.OasysConfig, sigcache *lru.ARCCache, ethAPI *ethapi.PublicBlockChainAPI, +func newSnapshot(config *params.ChainConfig, sigcache *lru.ARCCache, ethAPI *ethapi.PublicBlockChainAPI, number uint64, hash common.Hash, validators []common.Address, environment *environmentValue) *Snapshot { snap := &Snapshot{ config: config, @@ -58,7 +58,7 @@ func newSnapshot(config *params.OasysConfig, sigcache *lru.ARCCache, ethAPI *eth } // loadSnapshot loads an existing snapshot from the database. -func loadSnapshot(config *params.OasysConfig, sigcache *lru.ARCCache, ethAPI *ethapi.PublicBlockChainAPI, +func loadSnapshot(config *params.ChainConfig, sigcache *lru.ARCCache, ethAPI *ethapi.PublicBlockChainAPI, db ethdb.Database, hash common.Hash) (*Snapshot, error) { blob, err := db.Get(append([]byte("oasys-"), hash[:]...)) if err != nil { @@ -130,7 +130,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea var exists bool if number > 0 && number%snap.Environment.EpochPeriod.Uint64() == 0 { - nextValidator, err := getNextValidators(s.ethAPI, header.ParentHash, snap.Environment.Epoch(number)) + nextValidator, err := getNextValidators(s.config, s.ethAPI, header.ParentHash, snap.Environment.Epoch(number), number) if err != nil { log.Error("Failed to get validators", "in", "Snapshot.apply", "hash", header.ParentHash, "number", number, "err", err) return nil, err diff --git a/contracts/oasys/contracts.go b/contracts/oasys/contracts.go index 11473575e..78acf691b 100644 --- a/contracts/oasys/contracts.go +++ b/contracts/oasys/contracts.go @@ -10,6 +10,14 @@ var ( name: "OASMultiTransfer", address: "0x520000000000000000000000000000000000002c", } + candidateValidatorManagerHighStakes = &contract{ + name: "CandidateValidatorManager/highStakes", + address: "0x520000000000000000000000000000000000002D", + } + candidateValidatorManager = &contract{ + name: "CandidateValidatorManager", + address: "0x520000000000000000000000000000000000002e", + } // ERC20 Tokens wrappedOAS = &contract{ diff --git a/contracts/oasys/deployments.go b/contracts/oasys/deployments.go index 9f545aa81..a361cb387 100644 --- a/contracts/oasys/deployments.go +++ b/contracts/oasys/deployments.go @@ -627,34 +627,148 @@ var ( }, } + deployments9 = []*deployment{ + { + // commit: https://github.com/oasysgames/oasys-optimism/blob/5186190c3250121179064b70d8e2fbd2d0a03ce3/packages/contracts/contracts/oasys/L1/build/L1BuildAgent.sol + contract: l1BuildAgent, + code: mustDecodeCode(`0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806365c11a6c1161008c5780639f05c9ea116100665780639f05c9ea14610222578063a708ca6b14610242578063b61f370e14610255578063c86fc4c91461027557600080fd5b806365c11a6c146101cf57806366ed9d1b146101ef57806385c89dad1461020f57600080fd5b8063408d2693116100bd578063408d2693146101565780634dbbce2a1461018c57806364f57cb3146101ad57600080fd5b80630d5242f7146100e45780631ee5c97d1461012157806328f833b714610136575b600080fd5b6100f76100f23660046110e0565b610288565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61013461012f3660046111e2565b6103b3565b005b6000546100f79073ffffffffffffffffffffffffffffffffffffffff1681565b6100f761016436600461121e565b60009081526005602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b61019f61019a36600461121e565b6107ce565b604051610118929190611288565b6101c06101bb366004611373565b61092b565b60405161011893929190611395565b6004546100f79073ffffffffffffffffffffffffffffffffffffffff1681565b6003546100f79073ffffffffffffffffffffffffffffffffffffffff1681565b61013461021d3660046113f5565b610add565b6001546100f79073ffffffffffffffffffffffffffffffffffffffff1681565b610134610250366004611453565b610c9c565b6002546100f79073ffffffffffffffffffffffffffffffffffffffff1681565b6101346102833660046114a0565b610dc6565b805160208083019190912060008481526006909252604082208054835b8181101561034557838382815481106102c0576102c061150d565b906000526020600020016040516102d79190611590565b604051809103902014156103335760008781526007602052604090208054829081106103055761030561150d565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1694506103ad9350505050565b8061033d81611692565b9150506102a5565b506040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f7420666f756e64000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b92915050565b60008381526005602052604090205473ffffffffffffffffffffffffffffffffffffffff161561043f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f616c7265616479206275696c740000000000000000000000000000000000000060448201526064016103a4565b6000546040517ff3701da200000000000000000000000000000000000000000000000000000000815233600482018190529173ffffffffffffffffffffffffffffffffffffffff169063f3701da290602401600060405180830381600087803b1580156104ab57600080fd5b505af11580156104bf573d6000803e3d6000fd5b50506001546040517f1ee5c97d0000000000000000000000000000000000000000000000000000000081526004810188905273ffffffffffffffffffffffffffffffffffffffff878116602483015286811660448301529091169250631ee5c97d9150606401600060405180830381600087803b15801561053f57600080fd5b505af1158015610553573d6000803e3d6000fd5b50506002546040517f7ef7cca20000000000000000000000000000000000000000000000000000000081526004810188905273ffffffffffffffffffffffffffffffffffffffff85811660248301529091169250637ef7cca29150604401600060405180830381600087803b1580156105cb57600080fd5b505af11580156105df573d6000803e3d6000fd5b50506003546040517f7ef7cca20000000000000000000000000000000000000000000000000000000081526004810188905273ffffffffffffffffffffffffffffffffffffffff85811660248301529091169250637ef7cca29150604401600060405180830381600087803b15801561065757600080fd5b505af115801561066b573d6000803e3d6000fd5b5050600480546040517f7ef7cca200000000000000000000000000000000000000000000000000000000815291820188905273ffffffffffffffffffffffffffffffffffffffff8581166024840152169250637ef7cca29150604401600060405180830381600087803b1580156106e157600080fd5b505af11580156106f5573d6000803e3d6000fd5b50506008805460018082019092557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915560098054928301815560009081527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af9092018890556040518894509092507fd8406a18b0c7572d0adae5f0a479d5d802035e2c506e9353b092d25997f61a629190a350505050565b60008181526006602090815260408083206007835281842081548351818602810186019094528084526060958695939492938592919084015b828210156108b35783829060005260206000200180546108269061153c565b80601f01602080910402602001604051908101604052809291908181526020018280546108529061153c565b801561089f5780601f106108745761010080835404028352916020019161089f565b820191906000526020600020905b81548152906001019060200180831161088257829003601f168201915b505050505081526020019060010190610807565b5050505091508080548060200260200160405190810160405280929190818152602001828054801561091b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116108f0575b5050505050905091509150915091565b60085460609081906000908061094186886116cb565b106109535761095086826116e3565b94505b60008567ffffffffffffffff81111561096e5761096e6110b1565b604051908082528060200260200182016040528015610997578160200160208202803683370190505b50905060008667ffffffffffffffff8111156109b5576109b56110b1565b6040519080825280602002602001820160405280156109de578160200160208202803683370190505b50905060005b87811015610ac05760086109f8828b6116cb565b81548110610a0857610a0861150d565b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838281518110610a4557610a4561150d565b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101526009610a76828b6116cb565b81548110610a8657610a8661150d565b9060005260206000200154828281518110610aa357610aa361150d565b602090810291909101015280610ab881611692565b9150506109e4565b508181610acd898b6116cb565b9550955095505050509250925092565b60035473ffffffffffffffffffffffffffffffffffffffff163314610b5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f6f6e6c7920746865204c314275696c6453746570332063616e2063616c6c000060448201526064016103a4565b610b9e856040518060400160405280601a81526020017f4f564d5f4c3143726f7373446f6d61696e4d657373656e67657200000000000081525086610f7f565b610bc18560405180606001604052806021815260200161171c6021913985610f7f565b610c01856040518060400160405280601b81526020017f50726f78795f5f4f564d5f4c315374616e64617264427269646765000000000081525084610f7f565b610c41856040518060400160405280601981526020017f50726f78795f5f4f564d5f4c314552433732314272696467650000000000000081525083610f7f565b610c95856040518060400160405280601681526020017f4c3243726f7373446f6d61696e4d657373656e67657200000000000000000000815250734200000000000000000000000000000000000007610f7f565b5050505050565b60025473ffffffffffffffffffffffffffffffffffffffff163314610d1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f6f6e6c7920746865204c314275696c6453746570322063616e2063616c6c000060448201526064016103a4565b610d5d846040518060400160405280601481526020017f5374617465436f6d6d69746d656e74436861696e00000000000000000000000081525085610f7f565b610d80846040518060600160405280602181526020016116fb6021913984610f7f565b610dc0846040518060400160405280600b81526020017f426f6e644d616e6167657200000000000000000000000000000000000000000081525083610f7f565b50505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610e47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f6f6e6c7920746865204c314275696c6453746570312063616e2063616c6c000060448201526064016103a4565b60008681526005602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff89161790558151808301909252600d82527f4f564d5f53657175656e6365720000000000000000000000000000000000000090820152610ed490879086610f7f565b610f14866040518060400160405280600c81526020017f4f564d5f50726f706f736572000000000000000000000000000000000000000081525085610f7f565b610f54866040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e0000000000000081525084610f7f565b610f778660405180606001604052806021815260200161173d6021913983610f7f565b505050505050565b600083815260066020908152604082208054600181018255908352918190208451610fb1939190910191850190611018565b50600092835260076020908152604084208054600181018255908552932090920180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9093169290921790915550565b8280546110249061153c565b90600052602060002090601f016020900481019282611046576000855561108c565b82601f1061105f57805160ff191683800117855561108c565b8280016001018555821561108c579182015b8281111561108c578251825591602001919060010190611071565b5061109892915061109c565b5090565b5b80821115611098576000815560010161109d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156110f357600080fd5b82359150602083013567ffffffffffffffff8082111561111257600080fd5b818501915085601f83011261112657600080fd5b813581811115611138576111386110b1565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561117e5761117e6110b1565b8160405282815288602084870101111561119757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b803573ffffffffffffffffffffffffffffffffffffffff811681146111dd57600080fd5b919050565b6000806000606084860312156111f757600080fd5b83359250611207602085016111b9565b9150611215604085016111b9565b90509250925092565b60006020828403121561123057600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561127d57815173ffffffffffffffffffffffffffffffffffffffff168752958201959082019060010161124b565b509495945050505050565b6000604082016040835280855180835260608501915060608160051b860101925060208088016000805b84811015611353577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa089880301865282518051808952835b81811015611305578281018701518a820188015286016112ea565b81811115611315578487838c0101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016979097018401965094830194918301916001016112b2565b5050508584038187015250505061136a8185611237565b95945050505050565b6000806040838503121561138657600080fd5b50508035926020909101359150565b6060815260006113a86060830186611237565b82810360208481019190915285518083528682019282019060005b818110156113df578451835293830193918301916001016113c3565b5050809350505050826040830152949350505050565b600080600080600060a0868803121561140d57600080fd5b8535945061141d602087016111b9565b935061142b604087016111b9565b9250611439606087016111b9565b9150611447608087016111b9565b90509295509295909350565b6000806000806080858703121561146957600080fd5b84359350611479602086016111b9565b9250611487604086016111b9565b9150611495606086016111b9565b905092959194509250565b60008060008060008060c087890312156114b957600080fd5b863595506114c9602088016111b9565b94506114d7604088016111b9565b93506114e5606088016111b9565b92506114f3608088016111b9565b915061150160a088016111b9565b90509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600181811c9082168061155057607f821691505b6020821081141561158a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600080835481600182811c9150808316806115ac57607f831692505b60208084108214156115e5577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b8180156115f9576001811461162857611655565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650611655565b60008a81526020902060005b8681101561164d5781548b820152908501908301611634565b505084890196505b509498975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156116c4576116c4611663565b5060010190565b600082198211156116de576116de611663565b500190565b6000828210156116f5576116f5611663565b50039056fe436861696e53746f72616765436f6e7461696e65722d5343432d6261746368657350726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572436861696e53746f72616765436f6e7461696e65722d4354432d62617463686573a2646970667358221220c70f07fcb4927676b1a2cfebe530cc3e52ee51485f36a55a2a0c016a958a4cfe64736f6c63430008090033`), + }, + { + contract: l1BuildParam, + storage: storage{ + // bytes public l1ERC721BridgeCode, commit: https://github.com/oasysgames/oasys-optimism/blob/5186190c3250121179064b70d8e2fbd2d0a03ce3/packages/contracts/contracts/oasys/L1/messaging/L1ERC721BridgeV2.sol + "0x06": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80635d93a3fc1161005b5780635d93a3fc146100f45780638f45e47714610138578063c1bcfa4f1461014b578063dbfc9c3f1461015e57600080fd5b806330389967146100825780633cb747bf14610097578063485cc955146100e1575b600080fd5b610095610090366004610b04565b61017e565b005b6000546100b79073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100956100ef366004610b87565b610204565b610128610102366004610bc0565b600260209081526000938452604080852082529284528284209052825290205460ff1681565b60405190151581526020016100d8565b610095610146366004610c01565b6102d7565b610095610159366004610c99565b610727565b6001546100b79073ffffffffffffffffffffffffffffffffffffffff1681565b333b156101ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4163636f756e74206e6f7420454f41000000000000000000000000000000000060448201526064015b60405180910390fd5b6101fc8686333388888888610740565b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1615610284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f696e697469616c697a65206f6e6c79206f6e636500000000000000000000000060448201526064016101e3565b6000805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560018054929093169116179055565b60015473ffffffffffffffffffffffffffffffffffffffff1661030f60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e7469636174656400000000000000000000000000000000000060648201526084016101e3565b8073ffffffffffffffffffffffffffffffffffffffff166103ff60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b15801561044457600080fd5b505afa158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c9190610d10565b73ffffffffffffffffffffffffffffffffffffffff161461051f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d6573736167650000000000000000000000000000000060648201526084016101e3565b73ffffffffffffffffffffffffffffffffffffffff8089166000908152600260209081526040808320938b1683529281528282208783529052205460ff166105c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4e6f74206465706f73697465640000000000000000000000000000000000000060448201526064016101e3565b73ffffffffffffffffffffffffffffffffffffffff88811660008181526002602090815260408083208c8616845282528083208984529091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f23b872dd000000000000000000000000000000000000000000000000000000008152306004820152918716602483015260448201869052906323b872dd90606401600060405180830381600087803b15801561068357600080fd5b505af1158015610697573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f7fb3671da6a9a3c4b54a15e06575a4fa57d6264ad848930a6ea490e03e7514c1888888886040516107159493929190610d7d565b60405180910390a45050505050505050565b6107378787338888888888610740565b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff8089166000908152600260209081526040808320938b1683529281528282208783529052205460ff16156107e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f416c7265616479206465706f736974656400000000000000000000000000000060448201526064016101e3565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152306024830152604482018690528916906323b872dd90606401600060405180830381600087803b15801561085b57600080fd5b505af115801561086f573d6000803e3d6000fd5b50505050600063662a633a60e01b8989898989888860405160240161089a9796959493929190610dbd565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915260015490915061093e9073ffffffffffffffffffffffffffffffffffffffff1685836109f5565b73ffffffffffffffffffffffffffffffffffffffff808a1660008181526002602090815260408083208d86168085529083528184208b85529092529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790559051928a16929091907fd660bea642cb3af692ff947912f15e82ec86ad0796523ba971c5f369a6f989c5906109e2908b908b908a908a90610d7d565b60405180910390a4505050505050505050565b6000546040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633dbb202b90610a4f90869085908790600401610e1a565b600060405180830381600087803b158015610a6957600080fd5b505af1158015610737573d6000803e3d6000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a9f57600080fd5b50565b803563ffffffff81168114610ab657600080fd5b919050565b60008083601f840112610acd57600080fd5b50813567ffffffffffffffff811115610ae557600080fd5b602083019150836020828501011115610afd57600080fd5b9250929050565b60008060008060008060a08789031215610b1d57600080fd5b8635610b2881610a7d565b95506020870135610b3881610a7d565b945060408701359350610b4d60608801610aa2565b9250608087013567ffffffffffffffff811115610b6957600080fd5b610b7589828a01610abb565b979a9699509497509295939492505050565b60008060408385031215610b9a57600080fd5b8235610ba581610a7d565b91506020830135610bb581610a7d565b809150509250929050565b600080600060608486031215610bd557600080fd5b8335610be081610a7d565b92506020840135610bf081610a7d565b929592945050506040919091013590565b600080600080600080600060c0888a031215610c1c57600080fd5b8735610c2781610a7d565b96506020880135610c3781610a7d565b95506040880135610c4781610a7d565b94506060880135610c5781610a7d565b93506080880135925060a088013567ffffffffffffffff811115610c7a57600080fd5b610c868a828b01610abb565b989b979a50959850939692959293505050565b600080600080600080600060c0888a031215610cb457600080fd5b8735610cbf81610a7d565b96506020880135610ccf81610a7d565b95506040880135610cdf81610a7d565b945060608801359350610cf460808901610aa2565b925060a088013567ffffffffffffffff811115610c7a57600080fd5b600060208284031215610d2257600080fd5b8151610d2d81610a7d565b9392505050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff85168152836020820152606060408201526000610db3606083018486610d34565b9695505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808a1683528089166020840152808816604084015280871660608401525084608083015260c060a0830152610e0d60c083018486610d34565b9998505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8416815260006020606081840152845180606085015260005b81811015610e6457868101830151858201608001528201610e48565b81811115610e76576000608083870101525b5063ffffffff9490941660408401525050601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016016080019291505056fea26469706673582212206c2b77a3fea5aa85a79d440bfa071416f63f3deba4bc3abec3d3ca8768451e0164736f6c63430008090033", + }, + }, + { + // commit: https://github.com/oasysgames/oasys-genesis-contract/blob/c40adc981d07ccedd2cf2d3932ea9503761f6191/contracts/lib/AddressList.sol + contract: candidateValidatorManagerHighStakes, + code: mustDecodeCode(`0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806345788ce21161007157806345788ce21461016357806350fd73671461018e578063715018a6146101af5780638da5cb5b146101b9578063ab73e316146101ca578063f2fde38b146101dd57600080fd5b80630a3b0a4f146100b95780631907ebde146100e15780631f7b6d321461010157806321887c3d14610112578063225e25251461013d57806329092d0e14610150575b600080fd5b6100cc6100c7366004610975565b6101f0565b60405190151581526020015b60405180910390f35b6100f46100ef36600461099e565b610233565b6040516100d89190610a13565b6002546040519081526020016100d8565b6100cc610120366004610975565b6001600160a01b0316600090815260016020526040902054151590565b6100f461014b36600461099e565b61031c565b6100cc61015e366004610975565b6103fd565b610176610171366004610975565b610431565b6040516001600160a01b0390911681526020016100d8565b6101a161019c366004610a59565b610493565b6040516100d8929190610a7b565b6101b7610594565b005b6000546001600160a01b0316610176565b6101766101d8366004610975565b6105ca565b6101b76101eb366004610975565b610614565b600080546001600160a01b031633146102245760405162461bcd60e51b815260040161021b90610acc565b60405180910390fd5b61022d826106af565b92915050565b6000546060906001600160a01b031633146102605760405162461bcd60e51b815260040161021b90610acc565b818067ffffffffffffffff81111561027a5761027a610b01565b6040519080825280602002602001820160405280156102a3578160200160208202803683370190505b50915060005b81811015610314576102e08585838181106102c6576102c6610b17565b90506020020160208101906102db9190610975565b61078f565b8382815181106102f2576102f2610b17565b911515602092830291909101909101528061030c81610b43565b9150506102a9565b505092915050565b6000546060906001600160a01b031633146103495760405162461bcd60e51b815260040161021b90610acc565b818067ffffffffffffffff81111561036357610363610b01565b60405190808252806020026020018201604052801561038c578160200160208202803683370190505b50915060005b81811015610314576103c98585838181106103af576103af610b17565b90506020020160208101906103c49190610975565b6106af565b8382815181106103db576103db610b17565b91151560209283029190910190910152806103f581610b43565b915050610392565b600080546001600160a01b031633146104285760405162461bcd60e51b815260040161021b90610acc565b61022d8261078f565b6001600160a01b038116600090815260016020526040812054600281101561045a57600061048c565b60026104668183610b5e565b8154811061047657610476610b17565b6000918252602090912001546001600160a01b03165b9392505050565b600254606090600090806104a78587610b75565b106104b9576104b68582610b5e565b93505b6104c38486610b75565b91508367ffffffffffffffff8111156104de576104de610b01565b604051908082528060200260200182016040528015610507578160200160208202803683370190505b50925060005b8481101561058b5760026105218288610b75565b8154811061053157610531610b17565b9060005260206000200160009054906101000a90046001600160a01b031684828151811061056157610561610b17565b6001600160a01b03909216602092830291909101909101528061058381610b43565b91505061050d565b50509250929050565b6000546001600160a01b031633146105be5760405162461bcd60e51b815260040161021b90610acc565b6105c86000610925565b565b6001600160a01b03811660009081526001602081905260408220549081108015906105f6575060025481105b61060157600061048c565b6002818154811061047657610476610b17565b6000546001600160a01b0316331461063e5760405162461bcd60e51b815260040161021b90610acc565b6001600160a01b0381166106a35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161021b565b6106ac81610925565b50565b60006001600160a01b0382166106d85760405163e99d5ac560e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604090205480156107005750600092915050565b60028054600180820183557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180546001600160a01b0319166001600160a01b03871690811790915591546000838152602092909252604080832091909155517fdcfefddfe354ab15def7a2a6a8758e2ad4100c920318c627db94e29d833e15679190a250600192915050565b60006001600160a01b0382166107b85760405163e99d5ac560e01b815260040160405180910390fd5b6001600160a01b038216600090815260016020526040902054806107df5750600092915050565b6001600160a01b0383166000908152600160208190526040822082905560028054909161080b91610b5e565b8154811061081b5761081b610b17565b600091825260209091200154600280546001600160a01b039092169250908061084657610846610b8d565b600082815260209020810160001990810180546001600160a01b03191690550190556001600160a01b03818116908516146108e7576001600160a01b038116600090815260016020819052604090912083905581906002906108a89085610b5e565b815481106108b8576108b8610b17565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b6040516001600160a01b038516907f066a905b79c0121afe61e3a44e0b14b6bc1ec16d854cdba09efdfc9b6aa9af8190600090a25060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561098757600080fd5b81356001600160a01b038116811461048c57600080fd5b600080602083850312156109b157600080fd5b823567ffffffffffffffff808211156109c957600080fd5b818501915085601f8301126109dd57600080fd5b8135818111156109ec57600080fd5b8660208260051b8501011115610a0157600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015610a4d578351151583529284019291840191600101610a2f565b50909695505050505050565b60008060408385031215610a6c57600080fd5b50508035926020909101359150565b604080825283519082018190526000906020906060840190828701845b82811015610abd5781516001600160a01b031684529284019290840190600101610a98565b50505092019290925292915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415610b5757610b57610b2d565b5060010190565b600082821015610b7057610b70610b2d565b500390565b60008219821115610b8857610b88610b2d565b500190565b634e487b7160e01b600052603160045260246000fdfea264697066735822122045cb0552c2bcaf2e2a3f729cc78f6fc14d52c75562ab8ee201df8fca2eaae61864736f6c634300080c0033`), + storage: storage{ + // address private _owner + "0x00": candidateValidatorManager.address, + // mapping(address => uint256) private _ids + "0x01": genesismap{ + params.OasysMainnetGenesisHash: mapping{ + keyType: reflect.TypeOf(common.Address{}), + values: map[string]interface{}{ + "0x86652fE437425AC63211C55b6b067B3181BBcB17": big.NewInt(1), + "0xa505014a84e8BdC4A620470A53EAd872b0c1CA5b": big.NewInt(2), + "0xF5100e233E0A5AF82e9C6f3DEdF6Ca2E45099eF8": big.NewInt(3), + "0x4e5E774D3837bd9302B83CAD94a112575411F07B": big.NewInt(4), + "0x3C8075380217Eb85d4109226406cACda4c3BdB75": big.NewInt(5), + "0x9b64BE0ec5a334968b37BbD687EaDbc757DA6875": big.NewInt(6), + "0x3d821c7399ea97dA12e55727A378B4F5eb0289F8": big.NewInt(7), + "0xAf76F079631Ca0f3C090A98A2987b8D232C26447": big.NewInt(8), + "0xD47620F7904686E1B61bC2b16AD4Ef333623C3A4": big.NewInt(9), + "0xeC21628Fd017bbB0c751CB14BCbC6b81EB437241": big.NewInt(10), + "0x324D14607bB6853Fb0E15a02C80D59045714520F": big.NewInt(11), + "0x5F6831BDA9d0483054EB50A48966d65D2b156C7b": big.NewInt(12), + "0x6e28e5AF24dA4Cb7Bd669332244271eDce95f747": big.NewInt(13), + "0x5Ed4f15045aCfDd0392a7A0706503ae1aA2B82dc": big.NewInt(14), + "0x5646b6E8a0856766f0ace6D008f6919ad42Df82c": big.NewInt(15), + "0x025e6bEc8c34dBb38120840610004e8968790b7e": big.NewInt(16), + "0xB441A6A51BF69366d903c072D3B5594Ca02Ff1e0": big.NewInt(17), + "0x362EE93C00D8Bffc1e0284116d7CC9513cdE959F": big.NewInt(18), + "0x272d6bd040c2B8454f4f6F43115758fBe318ee2c": big.NewInt(19), + "0x80e358CBB533F6c8d07d2dc5604a55aA925A95df": big.NewInt(20), + "0xFCB42091aCBEf803e333A1b5C7079A43b0CFDE59": big.NewInt(21), + "0xaAF5a641256131484D00ACC565D84683025f2444": big.NewInt(22), + "0x18050B80d427B373C96AB24B78996310C0733c13": big.NewInt(23), + "0x4e5963c92bFE4De6f319b0859B2Efcf95267E3Ae": big.NewInt(24), + }, + }, + params.OasysTestnetGenesisHash: mapping{ + keyType: reflect.TypeOf(common.Address{}), + values: map[string]interface{}{ + "0xF886672205399c186638abfA9Dc155dEe9CBBD2e": big.NewInt(1), + }, + }, + }, + // address[] private _addresses + "0x02": genesismap{ + params.OasysMainnetGenesisHash: array{ + "0x86652fE437425AC63211C55b6b067B3181BBcB17", + "0xa505014a84e8BdC4A620470A53EAd872b0c1CA5b", + "0xF5100e233E0A5AF82e9C6f3DEdF6Ca2E45099eF8", + "0x4e5E774D3837bd9302B83CAD94a112575411F07B", + "0x3C8075380217Eb85d4109226406cACda4c3BdB75", + "0x9b64BE0ec5a334968b37BbD687EaDbc757DA6875", + "0x3d821c7399ea97dA12e55727A378B4F5eb0289F8", + "0xAf76F079631Ca0f3C090A98A2987b8D232C26447", + "0xD47620F7904686E1B61bC2b16AD4Ef333623C3A4", + "0xeC21628Fd017bbB0c751CB14BCbC6b81EB437241", + "0x324D14607bB6853Fb0E15a02C80D59045714520F", + "0x5F6831BDA9d0483054EB50A48966d65D2b156C7b", + "0x6e28e5AF24dA4Cb7Bd669332244271eDce95f747", + "0x5Ed4f15045aCfDd0392a7A0706503ae1aA2B82dc", + "0x5646b6E8a0856766f0ace6D008f6919ad42Df82c", + "0x025e6bEc8c34dBb38120840610004e8968790b7e", + "0xB441A6A51BF69366d903c072D3B5594Ca02Ff1e0", + "0x362EE93C00D8Bffc1e0284116d7CC9513cdE959F", + "0x272d6bd040c2B8454f4f6F43115758fBe318ee2c", + "0x80e358CBB533F6c8d07d2dc5604a55aA925A95df", + "0xFCB42091aCBEf803e333A1b5C7079A43b0CFDE59", + "0xaAF5a641256131484D00ACC565D84683025f2444", + "0x18050B80d427B373C96AB24B78996310C0733c13", + "0x4e5963c92bFE4De6f319b0859B2Efcf95267E3Ae", + }, + params.OasysTestnetGenesisHash: array{ + "0xF886672205399c186638abfA9Dc155dEe9CBBD2e", + }, + }, + }, + }, + { + // commit: https://github.com/oasysgames/oasys-genesis-contract/blob/c40adc981d07ccedd2cf2d3932ea9503761f6191/contracts/CandidateValidatorManager.sol + contract: candidateValidatorManager, + code: mustDecodeCode(`0x608060405234801561001057600080fd5b50600436106100625760003560e01c80630c53b46c1461006757806321b81652146100ab5780632d73a02f146100d157806374e2b63c146100e45780637542ff951461010b578063ad24c33a14610132575b600080fd5b61008e7f000000000000000000000000520000000000000000000000000000000000002d81565b6040516001600160a01b0390911681526020015b60405180910390f35b6100be6100b9366004610ce8565b610147565b6040516100a29796959493929190610d8a565b6100be6100df366004610ce8565b6102ae565b61008e7f000000000000000000000000000000000000000000000000000000000000100081565b61008e7f000000000000000000000000000000000000000000000000000000000000100181565b610145610140366004610e4d565b610395565b005b60608060608060608060007f00000000000000000000000000000000000000000000000000000000000010006001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d49190610e71565b8a10156101f457604051630eae4c9760e01b815260040160405180910390fd5b6040516350fd736760e01b8152600481018a9052602481018990527f000000000000000000000000520000000000000000000000000000000000002d6001600160a01b0316906350fd7367906044015b600060405180830381865afa158015610261573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102899190810190610efb565b9097509050610298878b610411565b9a9e939d50919b50995097965090945092505050565b60608080808080600089610341577f00000000000000000000000000000000000000000000000000000000000010006001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561031a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033e9190610e71565b99505b60405163085a3a2d60e21b8152600481018a9052602481018990527f00000000000000000000000000000000000000000000000000000000000010016001600160a01b031690632168e8b490604401610244565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000100116146103de57604051630101292160e31b815260040160405180910390fd5b6001600160a01b0381166104055760405163e99d5ac560e01b815260040160405180910390fd5b61040e81610700565b50565b60608060608060606000875190508067ffffffffffffffff81111561043857610438610e8a565b604051908082528060200260200182016040528015610461578160200160208202803683370190505b5095508067ffffffffffffffff81111561047d5761047d610e8a565b6040519080825280602002602001820160405280156104a6578160200160208202803683370190505b5094508067ffffffffffffffff8111156104c2576104c2610e8a565b6040519080825280602002602001820160405280156104eb578160200160208202803683370190505b5093508067ffffffffffffffff81111561050757610507610e8a565b604051908082528060200260200182016040528015610530578160200160208202803683370190505b5092508067ffffffffffffffff81111561054c5761054c610e8a565b604051908082528060200260200182016040528015610575578160200160208202803683370190505b50915060005b818110156106f4577f00000000000000000000000000000000000000000000000000000000000010016001600160a01b031663d1f18ee18a83815181106105c4576105c4610fb5565b60200260200101518a6040518363ffffffff1660e01b81526004016105fe9291906001600160a01b03929092168252602082015260400190565b60a060405180830381865afa15801561061b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063f9190610fe0565b8b868151811061065157610651610fb5565b602002602001018b878151811061066a5761066a610fb5565b602002602001018b888151811061068357610683610fb5565b602002602001018a898151811061069c5761069c610fb5565b602002602001018c8a815181106106b5576106b5610fb5565b60209081029190910101949094529315159092529215159091529115159091526001600160a01b039091169052806106ec81611056565b91505061057b565b50509295509295909350565b60007f00000000000000000000000000000000000000000000000000000000000010006001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610760573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107849190610e71565b90506000610793826001611071565b60405163fcbb371b60e01b8152600481018490529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000001000169063fcbb371b9060240161012060405180830381865afa1580156107ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108239190611089565b60c0015160405163fcbb371b60e01b8152600481018490529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000001000169063fcbb371b9060240161012060405180830381865afa158015610893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b79190611089565b60c00151604080516060810182526001600160a01b0380891680835292516322bc467160e11b81526004810193909352929350600092909160208301917f000000000000000000000000520000000000000000000000000000000000002d16906345788ce290602401602060405180830381865afa15801561093d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109619190611104565b6001600160a01b0390811682526040516355b9f18b60e11b815289821660048201526020909201917f000000000000000000000000520000000000000000000000000000000000002d9091169063ab73e31690602401602060405180830381865afa1580156109d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f89190611104565b6001600160a01b03169052905060005b60038160ff161015610cdf576000828260ff1660038110610a2b57610a2b610fb5565b602002015190506001600160a01b038116610a465750610ccd565b604051632ee462b360e01b81526001600160a01b0382811660048301526024820189905260009187917f00000000000000000000000000000000000000000000000000000000000010011690632ee462b390604401602060405180830381865afa158015610ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc9190610e71565b101590506000857f00000000000000000000000000000000000000000000000000000000000010016001600160a01b0316632ee462b3858b6040518363ffffffff1660e01b8152600401610b459291906001600160a01b03929092168252602082015260400190565b602060405180830381865afa158015610b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b869190610e71565b101590508180610b935750805b15610c2a57604051630a3b0a4f60e01b81526001600160a01b0384811660048301527f000000000000000000000000520000000000000000000000000000000000002d1690630a3b0a4f906024016020604051808303816000875af1158015610c00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c249190611121565b50610cc9565b81158015610c36575080155b15610cc957604051631484968760e11b81526001600160a01b0384811660048301527f000000000000000000000000520000000000000000000000000000000000002d16906329092d0e906024016020604051808303816000875af1158015610ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc79190611121565b505b5050505b80610cd78161113c565b915050610a08565b50505050505050565b600080600060608486031215610cfd57600080fd5b505081359360208301359350604090920135919050565b600081518084526020808501945080840160005b83811015610d4d5781516001600160a01b031687529582019590820190600101610d28565b509495945050505050565b600081518084526020808501945080840160005b83811015610d4d578151151587529582019590820190600101610d6c565b60e081526000610d9d60e083018a610d14565b602083820381850152610db0828b610d14565b91508382036040850152610dc4828a610d58565b91508382036060850152610dd88289610d58565b8481036080860152875180825282890193509082019060005b81811015610e0d57845183529383019391830191600101610df1565b505084810360a0860152610e218188610d58565b93505050508260c083015298975050505050505050565b6001600160a01b038116811461040e57600080fd5b600060208284031215610e5f57600080fd5b8135610e6a81610e38565b9392505050565b600060208284031215610e8357600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff81118282101715610ec457610ec4610e8a565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610ef357610ef3610e8a565b604052919050565b60008060408385031215610f0e57600080fd5b825167ffffffffffffffff80821115610f2657600080fd5b818501915085601f830112610f3a57600080fd5b8151602082821115610f4e57610f4e610e8a565b8160051b9250610f5f818401610eca565b8281529284018101928181019089851115610f7957600080fd5b948201945b84861015610fa35785519350610f9384610e38565b8382529482019490820190610f7e565b97909101519698969750505050505050565b634e487b7160e01b600052603260045260246000fd5b80518015158114610fdb57600080fd5b919050565b600080600080600060a08688031215610ff857600080fd5b855161100381610e38565b945061101160208701610fcb565b935061101f60408701610fcb565b925061102d60608701610fcb565b9150608086015190509295509295909350565b634e487b7160e01b600052601160045260246000fd5b600060001982141561106a5761106a611040565b5060010190565b6000821982111561108457611084611040565b500190565b6000610120828403121561109c57600080fd5b6110a4610ea0565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152508091505092915050565b60006020828403121561111657600080fd5b8151610e6a81610e38565b60006020828403121561113357600080fd5b610e6a82610fcb565b600060ff821660ff81141561115357611153611040565b6001019291505056fea264697066735822122082a01584713028389853236ce27242ae2ad212676d5e675565ce1b9469a72f2f64736f6c634300080c0033`), + }, + { + // commit: https://github.com/oasysgames/oasys-genesis-contract/blob/c40adc981d07ccedd2cf2d3932ea9503761f6191/contracts/StakeManager.sol + contract: stakeManager, + code: mustDecodeCode(`0x6080604052600436106102675760003560e01c806374e2b63c11610144578063cf5c13db116100b6578063e1aca3411161007a578063e1aca34114610850578063f3621e4314610870578063f65a5ed214610890578063f8d6b1ab146108b0578063fa52c7d8146108d0578063ff3d3f601461093f57600080fd5b8063cf5c13db1461074e578063d0051adf1461076e578063d1f18ee11461079f578063dbd61d87146107f7578063df93c8421461081757600080fd5b80639168ae72116101085780639168ae72146106785780639c508219146106ae578063a6a41f44146106ce578063ac7475ed146106ee578063ad71bd361461070e578063cbc0fac61461072e57600080fd5b806374e2b63c146105c75780637b520aa8146105ec5780637befa74f1461062257806388325234146106355780639043150b1461067057600080fd5b80632ee462b3116101dd578063485cc955116101a1578063485cc955146104e65780635c4fc4c5146105065780635d94ccf6146105365780635efc766e146105565780636b2b336914610576578063724319911461059657600080fd5b80632ee462b31461043757806333f32d7814610457578063428e85621461047757806345367f231461049757806346dfce7b146104b757600080fd5b8063195afea11161022f578063195afea11461032b5780631c1b4f3a1461034b5780632168e8b41461036b57806322226367146103995780632b42ed8c146103ce5780632b47da52146103ff57600080fd5b806302fb4d851461026c5780630ddda63c1461028e578063158ef93e146102ae5780631903cf16146102dd578063190b9257146102fd575b600080fd5b34801561027857600080fd5b5061028c610287366004614cb3565b61095f565b005b34801561029a57600080fd5b5061028c6102a9366004614cdf565b610b65565b3480156102ba57600080fd5b506000546102c89060ff1681565b60405190151581526020015b60405180910390f35b3480156102e957600080fd5b5061028c6102f8366004614d8a565b610d70565b34801561030957600080fd5b5061031d610318366004614cdf565b610f69565b6040519081526020016102d4565b34801561033757600080fd5b5061031d610346366004614cb3565b610f8a565b34801561035757600080fd5b5061031d610366366004614cdf565b610fc1565b34801561037757600080fd5b5061038b610386366004614e34565b610fd1565b6040516102d4929190614e9a565b3480156103a557600080fd5b506103b96103b4366004614cb3565b6110b7565b604080519283526020830191909152016102d4565b3480156103da57600080fd5b506103ee6103e9366004614ebc565b611185565b6040516102d4959493929190614f27565b34801561040b57600080fd5b5060015461041f906001600160a01b031681565b6040516001600160a01b0390911681526020016102d4565b34801561044357600080fd5b5061031d610452366004614cb3565b6114d2565b34801561046357600080fd5b5061031d610472366004614f87565b611585565b34801561048357600080fd5b5061028c610492366004614d8a565b611744565b3480156104a357600080fd5b5061031d6104b2366004614cdf565b61193d565b3480156104c357600080fd5b506104d76104d2366004614ebc565b6119d3565b6040516102d493929190615026565b3480156104f257600080fd5b5061028c61050136600461505c565b611c30565b34801561051257600080fd5b50610526610521366004614cb3565b611caf565b6040516102d494939291906150cd565b34801561054257600080fd5b5061028c610551366004614cdf565b611d7b565b34801561056257600080fd5b5061041f610571366004614cdf565b611e85565b34801561058257600080fd5b5061028c6105913660046150f8565b611eaf565b3480156105a257600080fd5b506105b66105b1366004615115565b611fa8565b6040516102d4959493929190615173565b3480156105d357600080fd5b5060005461041f9061010090046001600160a01b031681565b3480156105f857600080fd5b5061041f6106073660046150f8565b6006602052600090815260409020546001600160a01b031681565b61028c6106303660046151c0565b612048565b34801561064157600080fd5b506106556106503660046150f8565b612213565b604080519384526020840192909252908201526060016102d4565b61028c612293565b34801561068457600080fd5b5061041f6106933660046150f8565b6007602052600090815260409020546001600160a01b031681565b3480156106ba57600080fd5b5061031d6106c9366004614cb3565b6122c8565b3480156106da57600080fd5b5060095461041f906001600160a01b031681565b3480156106fa57600080fd5b5061028c6107093660046150f8565b6123a4565b34801561071a57600080fd5b5061038b610729366004614e34565b6124aa565b34801561073a57600080fd5b5061028c610749366004614cb3565b612588565b34801561075a57600080fd5b5061028c610769366004614cb3565b612630565b34801561077a57600080fd5b5061078e610789366004615205565b61282f565b6040516102d495949392919061523a565b3480156107ab57600080fd5b506107bf6107ba366004614cb3565b612ae7565b604080516001600160a01b0390961686529315156020860152911515928401929092529015156060830152608082015260a0016102d4565b34801561080357600080fd5b5061031d6108123660046152a3565b612c61565b34801561082357600080fd5b5061031d6108323660046150f8565b6001600160a01b031660009081526007602052604090206006015490565b34801561085c57600080fd5b5061028c61086b3660046151c0565b612ca7565b34801561087c57600080fd5b5061028c61088b3660046152a3565b612cc0565b34801561089c57600080fd5b5061041f6108ab366004614cdf565b612dcc565b3480156108bc57600080fd5b5061028c6108cb3660046150f8565b612ddc565b3480156108dc57600080fd5b506109196108eb3660046150f8565b6004602052600090815260409020805460018201546006909201546001600160a01b03918216929091169083565b604080516001600160a01b039485168152939092166020840152908201526060016102d4565b34801561094b57600080fd5b5061028c61095a3660046151c0565b612e3e565b6001600160a01b0380831660009081526006602090815260408083205484168084526004909252909120549091166109aa576040516372898ae960e11b815260040160405180910390fd5b3341146109ca57604051631cf4735960e01b815260040160405180910390fd5b6001600160a01b038084166000908152600660209081526040808320548416835260049182905280832083548251633fa4f24560e01b815292519195610add946101009092041692633fa4f2459281830192610120928290030181865afa158015610a39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5d91906152d3565b600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad4919061534e565b8491908761317e565b82546040519192506001600160a01b0316907f1647efd0ce9727dc31dc201c9d8d35ac687f7370adcacbd454afc6485ddabfda90600090a28015610b5e5781546040518281526001600160a01b03909116907feb7d7a49847ec491969db21a0e31b234565a9923145a2d1b56a75c9e95825802906020015b60405180910390a25b5050505050565b336000818152600460205260409020546001600160a01b0316610b9b576040516372898ae960e11b815260040160405180910390fd5b336000818152600760205260409020546001600160a01b0316610bd15760405163cf83d93d60e01b815260040160405180910390fd5b600060019054906101000a90046001600160a01b03166001600160a01b031663d4a536866040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c48919061537c565b15610c6657604051631e59ccd960e01b815260040160405180910390fd5b60008054338252600460205260408220610c8e9161010090046001600160a01b03168661325d565b905080610cae57604051637bc90c0560e11b815260040160405180910390fd5b610d323333600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2a919061534e565b60008561327d565b604051818152339081907fddd8e3ffe5c76cd1a7cca4b98662cb0a4e3da53ee24a873da632d28ba1043836906020015b60405180910390a350505050565b6001600160a01b03828116600090815260046020526040902080548492163314801590610daa575060018101546001600160a01b03163314155b15610dc857604051630101292160e31b815260040160405180910390fd5b6001600160a01b03808516600090815260046020526040902054859116610e02576040516372898ae960e11b815260040160405180910390fd5b600060019054906101000a90046001600160a01b03166001600160a01b031663d4a536866040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e79919061537c565b15610e9757604051631e59ccd960e01b815260040160405180910390fd5b610f30600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f11919061534e565b6001600160a01b03871660009081526004602052604090209086613392565b846001600160a01b03167fc11dfc9c24621433bb10587dc4bbae26a33a4aff53914e0d4c9fddf224a8cb7d85604051610b559190615397565b60028181548110610f7957600080fd5b600091825260209091200154905081565b600080546001600160a01b038481168352600460205260408320610fb792909161010090910416846133a4565b5090505b92915050565b60038181548110610f7957600080fd5b60606000610fe58484600580549050613537565b9093509050826001600160401b0381111561100257611002614cf8565b60405190808252806020026020018201604052801561102b578160200160208202803683370190505b50915060005b838110156110af57600561104582876153c0565b81548110611055576110556153d8565b9060005260206000200160009054906101000a90046001600160a01b0316838281518110611085576110856153d8565b6001600160a01b0390921660209283029190910190910152806110a7816153ee565b915050611031565b509250929050565b60008061117a6000841161114157600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611118573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113c919061534e565b611143565b835b6001600160a01b038616600090815260046020908152604080832093835260098401825280832054600a9094019091529020549091565b909590945092505050565b6001600160a01b03841660009081526007602052604081206060918291829182918861122757600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611222919061534e565b611229565b885b985061123b8888600580549050613537565b9097509150866001600160401b0381111561125857611258614cf8565b604051908082528060200260200182016040528015611281578160200160208202803683370190505b509550866001600160401b0381111561129c5761129c614cf8565b6040519080825280602002602001820160405280156112c5578160200160208202803683370190505b509450866001600160401b038111156112e0576112e0614cf8565b604051908082528060200260200182016040528015611309578160200160208202803683370190505b509350866001600160401b0381111561132457611324614cf8565b60405190808252806020026020018201604052801561134d578160200160208202803683370190505b50925060005b878110156114c5576005611367828b6153c0565b81548110611377576113776153d8565b9060005260206000200160009054906101000a90046001600160a01b03168782815181106113a7576113a76153d8565b60200260200101906001600160a01b031690816001600160a01b0316815250506113f88782815181106113dc576113dc6153d8565b602002602001015160008c8561356e909392919063ffffffff16565b86828151811061140a5761140a6153d8565b60200260200101818152505061144787828151811061142b5761142b6153d8565b602002602001015160018c8561356e909392919063ffffffff16565b858281518110611459576114596153d8565b60200260200101818152505061149687828151811061147a5761147a6153d8565b602002602001015160028c8561356e909392919063ffffffff16565b8482815181106114a8576114a86153d8565b6020908102919091010152806114bd816153ee565b915050611353565b5050945094509450945094565b600080821161155757600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561152e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611552919061534e565b611559565b815b6001600160a01b038416600090815260046020526040902090925061157e908361362d565b9392505050565b600080600183600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611602919061534e565b61160c9190615409565b6116169190615409565b845190915060005b8481101561173b576116316001846153c0565b6000805460405163fcbb371b60e01b81526004810184905292955090916101009091046001600160a01b03169063fcbb371b9060240161012060405180830381865afa158015611685573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a991906152d3565b905060005b83811015611726576117088286600460008c86815181106116d1576116d16153d8565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206136409092919063ffffffff16565b61171290876153c0565b95508061171e816153ee565b9150506116ae565b50508080611733906153ee565b91505061161e565b50505092915050565b6001600160a01b0382811660009081526004602052604090208054849216331480159061177e575060018101546001600160a01b03163314155b1561179c57604051630101292160e31b815260040160405180910390fd5b6001600160a01b038085166000908152600460205260409020548591166117d6576040516372898ae960e11b815260040160405180910390fd5b600060019054906101000a90046001600160a01b03166001600160a01b031663d4a536866040518163ffffffff1660e01b8152600401602060405180830381865afa158015611829573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184d919061537c565b1561186b57604051631e59ccd960e01b815260040160405180910390fd5b611904600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e5919061534e565b6001600160a01b038716600090815260046020526040902090866137ad565b846001600160a01b03167f0ad9bf1b8c026a174a2f30954417002a6ea00c9b08c1b8846c7951c687be809585604051610b559190615397565b60008082116119c257600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119bd919061534e565b6119c4565b815b9150610fbb60026003846137ba565b6001600160a01b0384166000908152600460205260408120606091829186611a7157600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6c919061534e565b611a73565b865b9650611a8786868360070180549050613537565b9095509150846001600160401b03811115611aa457611aa4614cf8565b604051908082528060200260200182016040528015611acd578160200160208202803683370190505b509350846001600160401b03811115611ae857611ae8614cf8565b604051908082528060200260200182016040528015611b11578160200160208202803683370190505b50925060005b85811015611c24576000600781848201611b31858c6153c0565b81548110611b4157611b416153d8565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054885191935090911690879084908110611b8757611b876153d8565b6001600160a01b0392831660209182029290920101528354611bae9183911660028c61356e565b8354611bc79083906001600160a01b031660018d61356e565b8454611be09084906001600160a01b031660008e61356e565b611bea91906153c0565b611bf491906153c0565b858381518110611c0657611c066153d8565b60209081029190910101525080611c1c816153ee565b915050611b17565b50509450945094915050565b334114611c5057604051631cf4735960e01b815260040160405180910390fd5b60005460ff1615611c735760405162dc149f60e41b815260040160405180910390fd5b6000805460016001600160a81b03199091166101006001600160a01b039586160217811790915580546001600160a01b03191691909216179055565b6001600160a01b03821660009081526007602052604081206006018054829182918291829187908110611ce457611ce46153d8565b6000918252602090912060408051606081019091526003909202018054829060ff166002811115611d1757611d17615095565b6002811115611d2857611d28615095565b81526020016001820154815260200160028201548152505090508060000151816020015182604001518360400151600014158015611d6a575083604001514210155b929a91995097509095509350505050565b336000818152600760205260409020546001600160a01b0316611db15760405163cf83d93d60e01b815260040160405180910390fd5b336000908152600760205260408120600601805484908110611dd557611dd56153d8565b9060005260206000209060030201905060008160020154905080421015611e0f576040516303cb96db60e21b815260040160405180910390fd5b80611e2d57604051630c8d9eab60e31b815260040160405180910390fd5b6000600283015560405184815233907fbf5f92dc2b945251eadf78c2ca629ae64053d979bfbc43a7b17a463707906bf99060200160405180910390a281546001830154611e7f9160ff169033906138d3565b50505050565b60058181548110611e9557600080fd5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b0381811660009081526006602052604090205433911615611eea5760405163055ee1f160e31b815260040160405180910390fd5b6001600160a01b0381166000908152600460205260409020611f0c90836139f2565b60058054600181019091557f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b038381166001600160a01b03199283168117909355841660009081526006602090815260409182902080549093168417909255519182527fd5828184f48f65962d10eac907318df85953d4e3542a0f09b5932ee3fe398bdd910160405180910390a15050565b600954604051632d73a02f60e01b81526004810185905260248101849052604481018390526060918291829182916000916001600160a01b031690632d73a02f90606401600060405180830381865afa158015612009573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612031919081019061554c565b959e949d50909b5099509297509095505050505050565b6001600160a01b03808416600090815260046020526040902054849116612082576040516372898ae960e11b815260040160405180910390fd5b600060019054906101000a90046001600160a01b03166001600160a01b031663d4a536866040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120f9919061537c565b1561211757604051631e59ccd960e01b815260040160405180910390fd5b8161213557604051637bc90c0560e11b815260040160405180910390fd5b612140833384613a34565b6121ce3385600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bc919061534e565b6121c79060016153c0565b868661327d565b836001600160a01b0316336001600160a01b03167f8fc656e319452025372383dc27d933046d412b8253de50a10739eeaa59862be68585604051610d6292919061564b565b6001600160a01b0380821660009081526007602052604081208154919283928392916122489183916101009091041684613ad5565b60005490945061226990829061010090046001600160a01b03166001613ad5565b60005490935061228a90829061010090046001600160a01b03166002613ad5565b93959294505050565b6040513481527f1de49774d094a85fc1bbbd16e8d09a865fb848218f41e2da4369f528c42ee42e9060200160405180910390a1565b6001600160a01b03808316600081815260066020908152604080832054851683526004909152812060018101549193909291161461230a576000915050610fbb565b6000831161238e57600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612365573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612389919061534e565b612390565b825b925061239c818461362d565b949350505050565b336000818152600460205260409020546001600160a01b03166123da576040516372898ae960e11b815260040160405180910390fd5b6001600160a01b03828116600090815260066020526040902054339116156124155760405163055ee1f160e31b815260040160405180910390fd5b6001600160a01b03808216600090815260046020526040902060018101549091166124408286613cfb565b6001600160a01b0385811660008181526006602090815260409182902080546001600160a01b031916888616908117909155825194861685529084019290925290917f758820d0b14a01c1fa60b8d2bbef25ed1b6a5af4802e5dec3f08679255ba8bf39101610b55565b606060006124be8484600880549050613537565b9093509050826001600160401b038111156124db576124db614cf8565b604051908082528060200260200182016040528015612504578160200160208202803683370190505b50915060005b838110156110af57600861251e82876153c0565b8154811061252e5761252e6153d8565b9060005260206000200160009054906101000a90046001600160a01b031683828151811061255e5761255e6153d8565b6001600160a01b039092166020928302919091019091015280612580816153ee565b91505061250a565b336000818152600460205260409020546001600160a01b03166125be576040516372898ae960e11b815260040160405180910390fd5b600080543382526004602052604082206125e69161010090046001600160a01b03168561325d565b60405181815290915033907f882d5671e5b36af50883197c33d48ba56ce337589958e871ba82fb0a54adf3e89060200160405180910390a28015611e7f57611e7f600033836138d3565b6001600160a01b0380831660009081526004602052604090205483911661266a576040516372898ae960e11b815260040160405180910390fd5b336000818152600760205260409020546001600160a01b03166126a05760405163cf83d93d60e01b815260040160405180910390fd5b600060019054906101000a90046001600160a01b03166001600160a01b031663d4a536866040518163ffffffff1660e01b8152600401602060405180830381865afa1580156126f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612717919061537c565b1561273557604051631e59ccd960e01b815260040160405180910390fd5b600080546001600160a01b03868116835260046020908152604080852033865260079092528420612770939092610100909104169087613d75565b90508061279057604051637bc90c0560e11b815260040160405180910390fd5b6127e83386600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d06573d6000803e3d6000fd5b6040518181526001600160a01b0386169033907fddd8e3ffe5c76cd1a7cca4b98662cb0a4e3da53ee24a873da632d28ba10438369060200160405180910390a35050505050565b6001600160a01b0383166000908152600760205260408120600681015460609283928392839291906128649089908990613537565b9097509150866001600160401b0381111561288157612881614cf8565b6040519080825280602002602001820160405280156128aa578160200160208202803683370190505b509550866001600160401b038111156128c5576128c5614cf8565b6040519080825280602002602001820160405280156128ee578160200160208202803683370190505b509450866001600160401b0381111561290957612909614cf8565b604051908082528060200260200182016040528015612932578160200160208202803683370190505b509350866001600160401b0381111561294d5761294d614cf8565b604051908082528060200260200182016040528015612976578160200160208202803683370190505b50925060005b87811015612ada57600060068301612994838c6153c0565b815481106129a4576129a46153d8565b6000918252602090912060408051606081019091526003909202018054829060ff1660028111156129d7576129d7615095565b60028111156129e8576129e8615095565b81526020016001820154815260200160028201548152505090508060000151888381518110612a1957612a196153d8565b60200260200101906002811115612a3257612a32615095565b90816002811115612a4557612a45615095565b815250508060200151878381518110612a6057612a606153d8565b6020026020010181815250508060400151868381518110612a8357612a836153d8565b6020908102919091010152604081015115801590612aa5575080604001514210155b858381518110612ab757612ab76153d8565b911515602092830291909101909101525080612ad2816153ee565b91505061297c565b5050939792965093509350565b60008080808085612b6c57600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b69919061534e565b95505b6001600160a01b03878116600090815260046020908152604080832060018101548b855260028201909352922054921696509060ff1660008881526003830160205260409020549015955060ff169350612bc6818861362d565b9150848015612bd3575083155b8015612c54575060005460405163fcbb371b60e01b8152600481018990526101009091046001600160a01b03169063fcbb371b9060240161012060405180830381865afa158015612c28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c4c91906152d3565b60c001518210155b9250509295509295909350565b600080546001600160a01b038481168352600460209081526040808520888416865260079092528420612c9e939092610100909104169085613dae565b50949350505050565b604051634ee5a1b960e01b815260040160405180910390fd5b6001600160a01b03808316600090815260046020526040902054839116612cfa576040516372898ae960e11b815260040160405180910390fd5b336000818152600760205260409020546001600160a01b0316612d305760405163cf83d93d60e01b815260040160405180910390fd5b600080546001600160a01b03868116835260046020908152604080852033865260079092528420612d6b939092610100909104169087613d75565b604080516001600160a01b03881681526020810183905291925033917f2ef606d064225d24c1514dc94907c134faee1237445c2f63f410cce0852b2054910160405180910390a28015612dc457612dc4600033836138d3565b505050505050565b60088181548110611e9557600080fd5b336000818152600760205260409020546001600160a01b0316612e125760405163cf83d93d60e01b815260040160405180910390fd5b6000805433825260076020526040909120612e3a9161010090046001600160a01b0316613fb8565b5050565b6001600160a01b03808416600090815260046020526040902054849116612e78576040516372898ae960e11b815260040160405180910390fd5b336000818152600760205260409020546001600160a01b0316612eae5760405163cf83d93d60e01b815260040160405180910390fd5b600060019054906101000a90046001600160a01b03166001600160a01b031663d4a536866040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f25919061537c565b15612f4357604051631e59ccd960e01b815260040160405180910390fd5b33600090815260076020908152604080832083546001600160a01b038a81168652600490945291909320612f81928492610100900416908888613fdc565b935083612fa157604051637bc90c0560e11b815260040160405180910390fd5b806006016040518060600160405280876002811115612fc257612fc2615095565b815260208101879052604001612fdb42620d2f006153c0565b9052815460018181018455600093845260209093208251600390920201805492939092839160ff199091169083600281111561301957613019615095565b0217905550602082015181600101556040820151816002015550506130c56003600060019054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561308c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130b0919061534e565b6130bb9060016153c0565b6002919087614112565b50600954604051635692619d60e11b81526001600160a01b0388811660048301529091169063ad24c33a90602401600060405180830381600087803b15801561310d57600080fd5b505af1158015613121573d6000803e3d6000fd5b50505060068201546001600160a01b038816915033907fb649014faa7a0e23357e091fb8a67a128c33dc9480f846f7e41cb3a6c9d806109061316590600190615409565b60405190815260200160405180910390a3505050505050565b60008281526009850160205260408120546131a757600083815260098601602052604090208290555b6000838152600a860160205260408120546131c39060016153c0565b6000858152600a88016020526040902081905560e0860151909150811080159061320f57506003860160006131f98660016153c0565b815260208101919091526040016000205460ff16155b15612c9e5761010085015161322490856153c0565b91505b81841015612c9e5783613239816153ee565b60008181526003890160205260409020805460ff1916600117905594506132279050565b600080600061326d8686866133a4565b6006880155925050509392505050565b6001600160a01b03808616600090815260076020526040902080549091166132f65780546001600160a01b0387166001600160a01b031991821681178355600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180549092161790555b6001600160a01b038516600090815260046020526040902061331d908290869086866141ed565b61332b6002600386856142b5565b600954604051635692619d60e11b81526001600160a01b0387811660048301529091169063ad24c33a90602401600060405180830381600087803b15801561337257600080fd5b505af1158015613386573d6000803e3d6000fd5b50505050505050505050565b61339f838383600061439b565b505050565b6000808460060154905060006001856001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156133f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613414919061534e565b61341e9190615409565b905083158061343557508061343383866153c0565b115b15613447576134448282615409565b93505b60005b8481101561352d5761345d6001846153c0565b60405163fcbb371b60e01b8152600481018290529093506000906001600160a01b0388169063fcbb371b9060240161012060405180830381865afa1580156134a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134cd91906152d3565b905060006134dc898387613640565b9050806134ea57505061351b565b60a08201516134fa57505061351b565b61350c818360a0015160646019614421565b61351690876153c0565b955050505b80613525816153ee565b91505061344a565b5050935093915050565b6000808261354585876153c0565b10613557576135548584615409565b93505b8361356281876153c0565b91509150935093915050565b600061362485600201600085600281111561358b5761358b615095565b600281111561359c5761359c615095565b81526020019081526020016000206000866001600160a01b03166001600160a01b03168152602001908152602001600020838760010160008760028111156135e6576135e6615095565b60028111156135f7576135f7615095565b8152602080820192909252604090810160009081206001600160a01b038b168252909252902091906137ba565b95945050505050565b600061157e6004840160058501846137ba565b600081815260028401602052604081205460ff168061366f5750600082815260038501602052604090205460ff165b1561367c5750600061157e565b6000613688858461362d565b9050604983106136c9578360c001518110156136a857600091505061157e565b629896806136b882610a34615666565b6136c29190615685565b9150613762565b806136d857600091505061157e565b6136e46019600a615783565b6136f585608001516064601961444d565b6136ff9083615666565b6137099190615685565b91508161371a57600091505061157e565b61373d846060015185604001516137319190615666565b6301e13380601961444d565b6137479083615666565b91506137556019600a615783565b61375f9083615685565b91505b6000838152600a8601602052604090205480156137a45760008481526009870160205260409020546137a0846137988484615409565b836019614421565b9350505b50509392505050565b61339f838383600161439b565b82546000908015806137e8575082856000815481106137db576137db6153d8565b9060005260206000200154115b156137f757600091505061157e565b8285613804600184615409565b81548110613814576138146153d8565b9060005260206000200154116138535783613830600183615409565b81548110613840576138406153d8565b906000526020600020015491505061157e565b6001811180156138895750828561386b600284615409565b8154811061387b5761387b6153d8565b906000526020600020015411155b1561389a5783613830600283615409565b60006138a98685600085614489565b90508481815481106138bd576138bd6153d8565b9060005260206000200154925050509392505050565b6000808460028111156138e8576138e8615095565b1415613947576040516001600160a01b038416908390600081818185875af1925050503d8060008114613937576040519150601f19603f3d011682016040523d82523d6000602084013e61393c565b606091505b5050809150506139c9565b61395084614531565b60405163a9059cbb60e01b81526001600160a01b03858116600483015260248201859052919091169063a9059cbb906044015b6020604051808303816000875af11580156139a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139c6919061537c565b90505b80611e7f5783604051630db5347560e11b81526004016139e9919061578f565b60405180910390fd5b81546001600160a01b031615613a1a57604051621d934160e11b815260040160405180910390fd5b81546001600160a01b03191633178255612e3a8282613cfb565b6000836002811115613a4857613a48615095565b1415613a6e5780341461339f57604051630fe5b06560e11b815260040160405180910390fd5b3415613a8d5760405163a745ac8560e01b815260040160405180910390fd5b6000613a9884614531565b6040516323b872dd60e01b81526001600160a01b0385811660048301523060248301526044820185905291909116906323b872dd90606401613983565b600080846003016000846002811115613af057613af0615095565b6002811115613b0157613b01615095565b8152602081019190915260400160002054905080613b2357600091505061157e565b6000846001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613b63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b87919061534e565b90506000613b96600184615409565b9050600081118015613bf9575081876003016000876002811115613bbc57613bbc615095565b6002811115613bcd57613bcd615095565b81526020019081526020016000208281548110613bec57613bec6153d8565b9060005260206000200154115b15613c0c5780613c088161579d565b9150505b81876003016000876002811115613c2557613c25615095565b6002811115613c3657613c36615095565b81526020019081526020016000208281548110613c5557613c556153d8565b90600052602060002001541115613c72576000935050505061157e565b6000805b828111613cef57886004016000886002811115613c9557613c95615095565b6002811115613ca657613ca6615095565b81526020019081526020016000208181548110613cc557613cc56153d8565b906000526020600020015482613cdb91906153c0565b915080613ce7816153ee565b915050613c76565b50979650505050505050565b6001600160a01b038116613d2257604051637138356f60e01b815260040160405180910390fd5b81546001600160a01b0382811691161415613d505760405163e037058f60e01b815260040160405180910390fd5b60019190910180546001600160a01b0319166001600160a01b03909216919091179055565b6000806000613d8687878787613dae565b86546001600160a01b0316600090815260058a01602052604090205592505050949350505050565b81546001600160a01b039081166000908152600586016020908152604080832054815163900cf0cf60e01b81529151939490938593600193928a169263900cf0cf92600480830193928290030181865afa158015613e10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e34919061534e565b613e3e9190615409565b9050831580613e55575080613e5383866153c0565b115b15613e6757613e648282615409565b93505b60005b84811015613fad57613e7d6001846153c0565b8654909350600090613e9c908a906001600160a01b031660028761356e565b8754613eb5908b906001600160a01b031660018861356e565b8854613ece908c906001600160a01b031660008961356e565b613ed891906153c0565b613ee291906153c0565b905080613eef5750613f9b565b60405163fcbb371b60e01b815260048101859052600090613f68906001600160a01b038b169063fcbb371b9060240161012060405180830381865afa158015613f3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f6091906152d3565b89908761459c565b905080613f76575050613f9b565b613f8c8183613f858b8961362d565b6019614421565b613f9690876153c0565b955050505b80613fa5816153ee565b915050613e6a565b505094509492505050565b613fc4828260016145e7565b613fd0828260026145e7565b612e3a828260006145e7565b60006140f8866002016000856002811115613ff957613ff9615095565b600281111561400a5761400a615095565b81526020808201929092526040908101600090812088546001600160a01b03908116835290845290829020825163900cf0cf60e01b815292519093918a169263900cf0cf9260048083019391928290030181865afa158015614070573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614094919061534e565b61409f9060016153c0565b848960010160008860028111156140b8576140b8615095565b60028111156140c9576140c9615095565b8152602080820192909252604090810160009081208b546001600160a01b031682529092529020929190614112565b91508161410757506000613624565b612c9e84868461490d565b835460009080158061414957508561412b600183615409565b8154811061413b5761413b6153d8565b906000526020600020015484105b1561416757604051630eae4c9760e01b815260040160405180910390fd5b600061417487878761498d565b9050600086828154811061418a5761418a6153d8565b90600052602060002001549050808511156141a557806141a7565b845b945084156141e157848783815481106141c2576141c26153d8565b9060005260206000200160008282546141db9190615409565b90915550505b50929695505050505050565b61429c85600201600084600281111561420857614208615095565b600281111561421957614219615095565b81526020808201929092526040908101600090812087546001600160a01b031682529092528120908690849060018a019087600281111561425c5761425c615095565b600281111561426d5761426d615095565b8152602080820192909252604090810160009081208a546001600160a01b0316825290925290209291906142b5565b8454610b5e90849086906001600160a01b031684614b9d565b83546001811180156142ec5750846142ce600183615409565b815481106142de576142de6153d8565b906000526020600020015483105b801561431d5750846142ff600283615409565b8154811061430f5761430f6153d8565b906000526020600020015483105b1561433b57604051630eae4c9760e01b815260040160405180910390fd5b600061434886868661498d565b8654925090505b81811015612dc4578285828154811061436a5761436a6153d8565b90600052602060002001600082825461438391906153c0565b90915550819050614393816153ee565b91505061434f565b815160005b81811015612dc45760008482815181106143bc576143bc6153d8565b6020026020010151905085811180156143ec5750600081815260028801602052604090205460ff16151584151514155b1561440e5760008181526002880160205260409020805460ff19168515151790555b5080614419816153ee565b9150506143a0565b600061442e82600a615783565b61443985858561444d565b6144439087615666565b6136249190615685565b60008061445b8360016153c0565b61446690600a615783565b6144709086615666565b9050600a61447e8583615685565b6144439060056153c0565b6000818314156144a55761449e600183615409565b905061239c565b600060026144b384866153c0565b6144bd9190615685565b9050848682815481106144d2576144d26153d8565b906000526020600020015411156144f7576144ef86868684614489565b91505061239c565b8486828154811061450a5761450a6153d8565b90600052602060002001541015613624576144ef868661452b8460016153c0565b86614489565b6000600182600281111561454757614547615095565b141561455b57506001602960991b01919050565b600282600281111561456f5761456f615095565b141561458357506002602960991b01919050565b604051638698bf3760e01b815260040160405180910390fd5b6000806145aa858585613640565b9050806145bb57600091505061157e565b60a08401516145cb57905061157e565b6145dd818560a0015160646019614421565b6136249082615409565b60006145f4848484613ad5565b9050806146015750505050565b600084600301600084600281111561461b5761461b615095565b600281111561462c5761462c615095565b8152602001908152602001600020805490509050836001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561467e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146a2919061534e565b8560030160008560028111156146ba576146ba615095565b60028111156146cb576146cb615095565b81526020019081526020016000206001836146e69190615409565b815481106146f6576146f66153d8565b9060005260206000200154116147915784600301600084600281111561471e5761471e615095565b600281111561472f5761472f615095565b815260200190815260200160002060006147499190614c1d565b84600401600084600281111561476157614761615095565b600281111561477257614772615095565b8152602001908152602001600020600061478c9190614c1d565b6148f6565b60405180602001604052808660030160008660028111156147b4576147b4615095565b60028111156147c5576147c5615095565b81526020019081526020016000206001846147e09190615409565b815481106147f0576147f06153d8565b906000526020600020015481525085600301600085600281111561481657614816615095565b600281111561482757614827615095565b81526020810191909152604001600020614842916001614c3e565b50604051806020016040528086600401600086600281111561486657614866615095565b600281111561487757614877615095565b81526020019081526020016000206001846148929190615409565b815481106148a2576148a26153d8565b90600052602060002001548152508560040160008560028111156148c8576148c8615095565b60028111156148d9576148d9615095565b815260208101919091526040016000206148f4916001614c3e565b505b8454610b5e9084906001600160a01b0316846138d3565b611e7f83600501836001600160a01b031663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614952573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614976919061534e565b6149819060016153c0565b60048601919084614112565b8254600090806149c857505082546001818101855560008581526020808220909301849055845491820185558481529182200181905561157e565b60006149d5600183615409565b905060008682815481106149eb576149eb6153d8565b9060005260206000200154905080851415614a0a5750915061157e9050565b80851115614a725786546001810188556000888152602090200185905585548690819084908110614a3d57614a3d6153d8565b6000918252602080832090910154835460018181018655948452919092200155614a689083906153c0565b935050505061157e565b600082118015614aa7575086614a89600184615409565b81548110614a9957614a996153d8565b906000526020600020015485145b15614ab757614a68600183615409565b86878381548110614aca57614aca6153d8565b6000918252602080832090910154835460018101855593835291209091015585548690819084908110614aff57614aff6153d8565b6000918252602080832090910154835460018101855593835291209091015586548590889084908110614b3457614b346153d8565b6000918252602090912001558115614b725785614b52600184615409565b81548110614b6257614b626153d8565b9060005260206000200154614b75565b60005b868381548110614b8757614b876153d8565b60009182526020909120015550915061157e9050565b6001600160a01b038216600090815260088501602052604090205460ff16614c0b576001600160a01b038216600081815260088601602090815260408220805460ff191660019081179091556007880180549182018155835291200180546001600160a01b03191690911790555b611e7f600485016005860185846142b5565b5080546000825590600052602060002090810190614c3b9190614c89565b50565b828054828255906000526020600020908101928215614c79579160200282015b82811115614c79578251825591602001919060010190614c5e565b50614c85929150614c89565b5090565b5b80821115614c855760008155600101614c8a565b6001600160a01b0381168114614c3b57600080fd5b60008060408385031215614cc657600080fd5b8235614cd181614c9e565b946020939093013593505050565b600060208284031215614cf157600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b60405161012081016001600160401b0381118282101715614d3157614d31614cf8565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614d5f57614d5f614cf8565b604052919050565b60006001600160401b03821115614d8057614d80614cf8565b5060051b60200190565b60008060408385031215614d9d57600080fd5b8235614da881614c9e565b91506020838101356001600160401b03811115614dc457600080fd5b8401601f81018613614dd557600080fd5b8035614de8614de382614d67565b614d37565b81815260059190911b82018301908381019088831115614e0757600080fd5b928401925b82841015614e2557833582529284019290840190614e0c565b80955050505050509250929050565b60008060408385031215614e4757600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b83811015614e8f5781516001600160a01b031687529582019590820190600101614e6a565b509495945050505050565b604081526000614ead6040830185614e56565b90508260208301529392505050565b60008060008060808587031215614ed257600080fd5b8435614edd81614c9e565b966020860135965060408601359560600135945092505050565b600081518084526020808501945080840160005b83811015614e8f57815187529582019590820190600101614f0b565b60a081526000614f3a60a0830188614e56565b8281036020840152614f4c8188614ef7565b90508281036040840152614f608187614ef7565b90508281036060840152614f748186614ef7565b9150508260808301529695505050505050565b60008060408385031215614f9a57600080fd5b82356001600160401b03811115614fb057600080fd5b8301601f81018513614fc157600080fd5b80356020614fd1614de383614d67565b82815260059290921b83018101918181019088841115614ff057600080fd5b938201935b8385101561501757843561500881614c9e565b82529382019390820190614ff5565b98969091013596505050505050565b6060815260006150396060830186614e56565b828103602084015261504b8186614ef7565b915050826040830152949350505050565b6000806040838503121561506f57600080fd5b823561507a81614c9e565b9150602083013561508a81614c9e565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b600381106150c957634e487b7160e01b600052602160045260246000fd5b9052565b608081016150db82876150ab565b846020830152836040830152821515606083015295945050505050565b60006020828403121561510a57600080fd5b813561157e81614c9e565b60008060006060848603121561512a57600080fd5b505081359360208301359350604090920135919050565b600081518084526020808501945080840160005b83811015614e8f578151151587529582019590820190600101615155565b60a08152600061518660a0830188614e56565b82810360208401526151988188614e56565b905082810360408401526151ac8187614ef7565b90508281036060840152614f748186615141565b6000806000606084860312156151d557600080fd5b83356151e081614c9e565b92506020840135600381106151f457600080fd5b929592945050506040919091013590565b60008060006060848603121561521a57600080fd5b833561522581614c9e565b95602085013595506040909401359392505050565b60a0808252865190820181905260009060209060c0840190828a01845b8281101561527a5761526a8483516150ab565b9284019290840190600101615257565b5050508381038285015261528e8189614ef7565b91505082810360408401526151ac8187614ef7565b6000806000606084860312156152b857600080fd5b83356152c381614c9e565b925060208401356151f481614c9e565b600061012082840312156152e657600080fd5b6152ee614d0e565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152508091505092915050565b60006020828403121561536057600080fd5b5051919050565b8051801515811461537757600080fd5b919050565b60006020828403121561538e57600080fd5b61157e82615367565b60208152600061157e6020830184614ef7565b634e487b7160e01b600052601160045260246000fd5b600082198211156153d3576153d36153aa565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415615402576154026153aa565b5060010190565b60008282101561541b5761541b6153aa565b500390565b600082601f83011261543157600080fd5b81516020615441614de383614d67565b82815260059290921b8401810191818101908684111561546057600080fd5b8286015b8481101561548457805161547781614c9e565b8352918301918301615464565b509695505050505050565b600082601f8301126154a057600080fd5b815160206154b0614de383614d67565b82815260059290921b840181019181810190868411156154cf57600080fd5b8286015b84811015615484576154e481615367565b83529183019183016154d3565b600082601f83011261550257600080fd5b81516020615512614de383614d67565b82815260059290921b8401810191818101908684111561553157600080fd5b8286015b848110156154845780518352918301918301615535565b600080600080600080600060e0888a03121561556757600080fd5b87516001600160401b038082111561557e57600080fd5b61558a8b838c01615420565b985060208a01519150808211156155a057600080fd5b6155ac8b838c01615420565b975060408a01519150808211156155c257600080fd5b6155ce8b838c0161548f565b965060608a01519150808211156155e457600080fd5b6155f08b838c0161548f565b955060808a015191508082111561560657600080fd5b6156128b838c016154f1565b945060a08a015191508082111561562857600080fd5b506156358a828b0161548f565b92505060c0880151905092959891949750929550565b6040810161565982856150ab565b8260208301529392505050565b6000816000190483118215151615615680576156806153aa565b500290565b6000826156a257634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156110af5781600019048211156156c8576156c86153aa565b808516156156d557918102915b93841c93908002906156ac565b6000826156f157506001610fbb565b816156fe57506000610fbb565b8160018114615714576002811461571e5761573a565b6001915050610fbb565b60ff84111561572f5761572f6153aa565b50506001821b610fbb565b5060208310610133831016604e8410600b841016171561575d575081810a610fbb565b61576783836156a7565b806000190482111561577b5761577b6153aa565b029392505050565b600061157e83836156e2565b60208101610fbb82846150ab565b6000816157ac576157ac6153aa565b50600019019056fea264697066735822122011bcd72f29891519cecf669abcb6b18e7aec1f45315d67eb5669e5a2a685d50d64736f6c634300080c0033`), + storage: storage{ + // ICandidateValidatorManager public candidateManager + "0x09": candidateValidatorManager.address, + }, + }, + } + deploymentSets = map[common.Hash]map[uint64]deploymentSet{ params.OasysMainnetGenesisHash: { - 1: deploymentSet{deployments0}, - 235000: deploymentSet{deployments1}, - 309600: deploymentSet{deployments2, deployments3, deployments4}, - 419000: deploymentSet{deployments5}, - 557100: deploymentSet{deployments6}, - 971800: deploymentSet{deployments7}, + 1: deploymentSet{deployments0}, + 235000: deploymentSet{deployments1}, + 309600: deploymentSet{deployments2, deployments3, deployments4}, + 419000: deploymentSet{deployments5}, + 557100: deploymentSet{deployments6}, + 971800: deploymentSet{deployments7}, + 1529980: deploymentSet{deployments9}, }, params.OasysTestnetGenesisHash: { - 1: deploymentSet{deployments0}, - 189400: deploymentSet{deployments2}, - 200800: deploymentSet{deployments1}, - 269700: deploymentSet{deployments3}, - 293000: deploymentSet{deployments4}, - 385000: deploymentSet{deployments5}, - 546400: deploymentSet{deployments6}, - 955400: deploymentSet{deployments7, deployments8}, + 1: deploymentSet{deployments0}, + 189400: deploymentSet{deployments2}, + 200800: deploymentSet{deployments1}, + 269700: deploymentSet{deployments3}, + 293000: deploymentSet{deployments4}, + 385000: deploymentSet{deployments5}, + 546400: deploymentSet{deployments6}, + 955400: deploymentSet{deployments7, deployments8}, + 1519840: deploymentSet{deployments9}, }, defaultGenesisHash: { - 1: deploymentSet{deployments0}, - 2: deploymentSet{deployments1}, - 3: deploymentSet{deployments2}, - 4: deploymentSet{deployments3}, - 5: deploymentSet{deployments4}, - 6: deploymentSet{deployments5}, - 7: deploymentSet{deployments6}, - 8: deploymentSet{deployments7, deployments8}, + 2: deploymentSet{ + deployments0, + deployments1, + deployments2, + deployments3, + deployments4, + deployments5, + deployments6, + deployments7, + deployments8, + deployments9, + }, }, } ) diff --git a/contracts/oasys/oasys_test.go b/contracts/oasys/oasys_test.go index dd7a45658..e60467357 100644 --- a/contracts/oasys/oasys_test.go +++ b/contracts/oasys/oasys_test.go @@ -53,6 +53,12 @@ type wantContract struct { storage map[string]string } +func (w *wantContract) mergeStorage(add map[string]string) { + for k, v := range add { + w.storage[k] = v + } +} + type wantContracts map[string]*wantContract type deployFn func(genesisHash common.Hash, contracts wantContracts) @@ -800,6 +806,219 @@ func _deployments8(genesisHash common.Hash, contracts wantContracts) { } } +func _deployments9(genesisHash common.Hash, contracts wantContracts) { + // L1BuildAgent + contracts["0x5200000000000000000000000000000000000008"].codeHash = "9a697a006cd8cb23689ae7b1fc6caef1" + + // L1BuildParam + contracts["0x5200000000000000000000000000000000000006"].mergeStorage(map[string]string{ + "0x0000000000000000000000000000000000000000000000000000000000000006": "0x0000000000000000000000000000000000000000000000000000000000001ddf", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d40": "0x80635d93a3fc1161005b5780635d93a3fc146100f45780638f45e47714610138", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d41": "0x578063c1bcfa4f1461014b578063dbfc9c3f1461015e57600080fd5b80633038", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d42": "0x9967146100825780633cb747bf14610097578063485cc955146100e1575b6000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d43": "0x80fd5b610095610090366004610b04565b61017e565b005b6000546100b79073", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d44": "0xffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d45": "0xffffffffffffffffffffffffffffffff90911681526020015b60405180910390", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d46": "0xf35b6100956100ef366004610b87565b610204565b610128610102366004610b", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d47": "0xc0565b6002602090815260009384526040808520825292845282842090528252", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d48": "0x90205460ff1681565b60405190151581526020016100d8565b61009561014636", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d49": "0x6004610c01565b6102d7565b610095610159366004610c99565b610727565b60", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4a": "0x01546100b79073ffffffffffffffffffffffffffffffffffffffff1681565b33", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4b": "0x3b156101ec576040517f08c379a0000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4c": "0x00000000000000000000815260206004820152600f60248201527f4163636f75", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4d": "0x6e74206e6f7420454f4100000000000000000000000000000000006044820152", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4e": "0x6064015b60405180910390fd5b6101fc8686333388888888610740565b505050", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4f": "0x505050565b60005473ffffffffffffffffffffffffffffffffffffffff161561", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d50": "0x0284576040517f08c379a0000000000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d51": "0x00000000000000815260206004820152601460248201527f696e697469616c69", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d52": "0x7a65206f6e6c79206f6e63650000000000000000000000006044820152606401", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d53": "0x6101e3565b6000805473ffffffffffffffffffffffffffffffffffffffff9384", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d54": "0x167fffffffffffffffffffffffff000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d55": "0x00009182161790915560018054929093169116179055565b60015473ffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d56": "0xffffffffffffffffffffffffffffffff1661030f60005473ffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d57": "0xffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d58": "0xffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d59": "0xc9576040517f08c379a000000000000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d5a": "0x000000000000815260206004820152602e60248201527f4f564d5f5843484149", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d5b": "0x4e3a206d657373656e67657220636f6e7472616374207560448201527f6e6175", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d5c": "0x7468656e74696361746564000000000000000000000000000000000000606482", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d5d": "0x01526084016101e3565b8073ffffffffffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d5e": "0x166103ff60005473ffffffffffffffffffffffffffffffffffffffff1690565b", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d5f": "0x73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d60": "0xffffffff1660e01b815260040160206040518083038186803b15801561044457", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d61": "0x600080fd5b505afa158015610458573d6000803e3d6000fd5b50505050604051", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d62": "0x3d601f19601f8201168201806040525081019061047c9190610d10565b73ffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d63": "0xffffffffffffffffffffffffffffffffffff161461051f576040517f08c379a0", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d64": "0x0000000000000000000000000000000000000000000000000000000081526020", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d65": "0x6004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d66": "0x656e646572206f662063726f7360448201527f732d646f6d61696e206d657373", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d67": "0x6167650000000000000000000000000000000060648201526084016101e3565b", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d68": "0x73ffffffffffffffffffffffffffffffffffffffff8089166000908152600260", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d69": "0x209081526040808320938b1683529281528282208783529052205460ff166105", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d6a": "0xc3576040517f08c379a000000000000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d6b": "0x000000000000815260206004820152600d60248201527f4e6f74206465706f73", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d6c": "0x6974656400000000000000000000000000000000000000604482015260640161", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d6d": "0x01e3565b73ffffffffffffffffffffffffffffffffffffffff88811660008181", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d6e": "0x526002602090815260408083208c861684528252808320898452909152908190", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d6f": "0x2080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d70": "0xffffff00169055517f23b872dd00000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d71": "0x0000000000000000008152306004820152918716602483015260448201869052", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d72": "0x906323b872dd90606401600060405180830381600087803b1580156106835760", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d73": "0x0080fd5b505af1158015610697573d6000803e3d6000fd5b505050508573ffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d74": "0xffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d75": "0xffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d76": "0x167f7fb3671da6a9a3c4b54a15e06575a4fa57d6264ad848930a6ea490e03e75", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d77": "0x14c1888888886040516107159493929190610d7d565b60405180910390a45050", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d78": "0x505050505050565b6107378787338888888888610740565b5050505050505056", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d79": "0x5b73ffffffffffffffffffffffffffffffffffffffff80891660009081526002", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d7a": "0x60209081526040808320938b1683529281528282208783529052205460ff1615", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d7b": "0x6107e5576040517f08c379a00000000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d7c": "0x0000000000000000815260206004820152601160248201527f416c7265616479", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d7d": "0x206465706f736974656400000000000000000000000000000060448201526064", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d7e": "0x016101e3565b6040517f23b872dd000000000000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d7f": "0x00000000000000000000815273ffffffffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d80": "0xff8781166004830152306024830152604482018690528916906323b872dd9060", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d81": "0x6401600060405180830381600087803b15801561085b57600080fd5b505af115", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d82": "0x801561086f573d6000803e3d6000fd5b50505050600063662a633a60e01b8989", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d83": "0x898989888860405160240161089a9796959493929190610dbd565b604080517f", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d84": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d85": "0x8184030181529190526020810180517bffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d86": "0xffffffffffffffffffffffff167fffffffff0000000000000000000000000000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d87": "0x0000000000000000000000000000909316929092179091526001549091506109", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d88": "0x3e9073ffffffffffffffffffffffffffffffffffffffff1685836109f5565b73", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d89": "0xffffffffffffffffffffffffffffffffffffffff808a16600081815260026020", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d8a": "0x90815260408083208d86168085529083528184208b8552909252918290208054", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d8b": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d8c": "0x001660011790559051928a16929091907fd660bea642cb3af692ff947912f15e", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d8d": "0x82ec86ad0796523ba971c5f369a6f989c5906109e2908b908b908a908a90610d", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d8e": "0x7d565b60405180910390a4505050505050505050565b6000546040517f3dbb20", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d8f": "0x2b00000000000000000000000000000000000000000000000000000000815273", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d90": "0xffffffffffffffffffffffffffffffffffffffff90911690633dbb202b90610a", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d91": "0x4f90869085908790600401610e1a565b600060405180830381600087803b1580", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d92": "0x15610a6957600080fd5b505af1158015610737573d6000803e3d6000fd5b73ff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d93": "0xffffffffffffffffffffffffffffffffffffff81168114610a9f57600080fd5b", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d94": "0x50565b803563ffffffff81168114610ab657600080fd5b919050565b60008083", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d95": "0x601f840112610acd57600080fd5b50813567ffffffffffffffff811115610ae5", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d96": "0x57600080fd5b602083019150836020828501011115610afd57600080fd5b9250", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d97": "0x929050565b60008060008060008060a08789031215610b1d57600080fd5b8635", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d98": "0x610b2881610a7d565b95506020870135610b3881610a7d565b94506040870135", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d99": "0x9350610b4d60608801610aa2565b9250608087013567ffffffffffffffff8111", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d9a": "0x15610b6957600080fd5b610b7589828a01610abb565b979a9699509497509295", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d9b": "0x939492505050565b60008060408385031215610b9a57600080fd5b8235610ba5", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d9c": "0x81610a7d565b91506020830135610bb581610a7d565b80915050925092905056", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d9d": "0x5b600080600060608486031215610bd557600080fd5b8335610be081610a7d56", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d9e": "0x5b92506020840135610bf081610a7d565b929592945050506040919091013590", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d9f": "0x565b600080600080600080600060c0888a031215610c1c57600080fd5b873561", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da0": "0x0c2781610a7d565b96506020880135610c3781610a7d565b9550604088013561", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da1": "0x0c4781610a7d565b94506060880135610c5781610a7d565b9350608088013592", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da2": "0x5060a088013567ffffffffffffffff811115610c7a57600080fd5b610c868a82", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da3": "0x8b01610abb565b989b979a50959850939692959293505050565b600080600080", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da4": "0x600080600060c0888a031215610cb457600080fd5b8735610cbf81610a7d565b", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da5": "0x96506020880135610ccf81610a7d565b95506040880135610cdf81610a7d565b", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da6": "0x945060608801359350610cf460808901610aa2565b925060a088013567ffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da7": "0xffffffffff811115610c7a57600080fd5b600060208284031215610d22576000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da8": "0x80fd5b8151610d2d81610a7d565b9392505050565b8183528181602085013750", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0da9": "0x600060208284010152600060207fffffffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0daa": "0xffffffffffffffffffffffffffe0601f840116840101905092915050565b73ff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0dab": "0xffffffffffffffffffffffffffffffffffffff85168152836020820152606060", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0dac": "0x408201526000610db3606083018486610d34565b9695505050505050565b6000", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0dad": "0x73ffffffffffffffffffffffffffffffffffffffff808a168352808916602084", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0dae": "0x0152808816604084015280871660608401525084608083015260c060a0830152", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0daf": "0x610e0d60c083018486610d34565b9998505050505050505050565b73ffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0db0": "0xffffffffffffffffffffffffffffffff84168152600060206060818401528451", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0db1": "0x80606085015260005b81811015610e6457868101830151858201608001528201", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0db2": "0x610e48565b81811115610e76576000608083870101525b5063ffffffff949094", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0db3": "0x1660408401525050601f919091017fffffffffffffffffffffffffffffffffff", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0db4": "0xffffffffffffffffffffffffffffe016016080019291505056fea26469706673", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0db5": "0x582212206c2b77a3fea5aa85a79d440bfa071416f63f3deba4bc3abec3d3ca87", + "0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0db6": "0x68451e0164736f6c634300080900330000000000000000000000000000000000", + }) + + // CandidateValidatorManager + contracts["0x520000000000000000000000000000000000002D"] = &wantContract{ + name: "CandidateValidatorManager/highStakes", + codeHash: "eaf544695b634164adae5287b1b74128", + } + contracts["0x520000000000000000000000000000000000002e"] = &wantContract{ + name: "CandidateValidatorManager", + codeHash: "702ed27a4ae1e5fcb22ce905b105eda2", + } + + switch genesisHash { + case params.OasysMainnetGenesisHash: + contracts["0x520000000000000000000000000000000000002D"].storage = map[string]string{ + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000520000000000000000000000000000000000002e", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000018", + "0xea4933d1d73bd232c5ca715ec0e4aab929d5998d22ea122c5d7d0264a4c84a6a": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace": "0x00000000000000000000000086652fe437425ac63211c55b6b067b3181bbcb17", + "0xaf4fd92dc6c3083ebfb1209dbdef5deb4504aa687437b4d2d978399f86db0c5f": "0x0000000000000000000000000000000000000000000000000000000000000002", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf": "0x000000000000000000000000a505014a84e8bdc4a620470a53ead872b0c1ca5b", + "0x0c778f5508ea4ed6532180ba034543db70fbb70e9ccfbaeca8f8be1f7b06068a": "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad0": "0x000000000000000000000000f5100e233e0a5af82e9c6f3dedf6ca2e45099ef8", + "0x9ca45c83e0a3687bd3fc4907ad9797e7d7b5354aa3e798896de74285c271e7f4": "0x0000000000000000000000000000000000000000000000000000000000000004", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad1": "0x0000000000000000000000004e5e774d3837bd9302b83cad94a112575411f07b", + "0xcf19c32954ebda58a9cd6d186b3cef43be23ad88c7f328e1da744759ea399da0": "0x0000000000000000000000000000000000000000000000000000000000000005", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad2": "0x0000000000000000000000003c8075380217eb85d4109226406cacda4c3bdb75", + "0x1459e5c96676d60c623e039e234df9bfd5ccc92d7272e1e73a136dec5ae76cac": "0x0000000000000000000000000000000000000000000000000000000000000006", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad3": "0x0000000000000000000000009b64be0ec5a334968b37bbd687eadbc757da6875", + "0x34267bf69c8a23e414a30a3710726bdb826758e6f920e300290ed544fa4fd994": "0x0000000000000000000000000000000000000000000000000000000000000007", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad4": "0x0000000000000000000000003d821c7399ea97da12e55727a378b4f5eb0289f8", + "0x103e54134ab2b16159d2a69b1af060fd5483b0d6b3a1533bba0e6474557802d4": "0x0000000000000000000000000000000000000000000000000000000000000008", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad5": "0x000000000000000000000000af76f079631ca0f3c090a98a2987b8d232c26447", + "0xa849bb2be5b43bac3a75237c92891cd0782aadbf0c2f21dac2b697311843eeb9": "0x0000000000000000000000000000000000000000000000000000000000000009", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad6": "0x000000000000000000000000d47620f7904686e1b61bc2b16ad4ef333623c3a4", + "0x0056ddab82156fc6b9c98fd148fbe89504c732215d9719e3e4ae143fe84404e2": "0x000000000000000000000000000000000000000000000000000000000000000a", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad7": "0x000000000000000000000000ec21628fd017bbb0c751cb14bcbc6b81eb437241", + "0xd30d2965ce03abfd668be20da5eb9d5fec0b2ba693c7aa1e3b4774c11f660643": "0x000000000000000000000000000000000000000000000000000000000000000b", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad8": "0x000000000000000000000000324d14607bb6853fb0e15a02c80d59045714520f", + "0x136ad448261e39765c378832d9bcce64560a0fad22a3ddb86c0448a7dab506b8": "0x000000000000000000000000000000000000000000000000000000000000000c", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad9": "0x0000000000000000000000005f6831bda9d0483054eb50a48966d65d2b156c7b", + "0xfbe4a2b6af18f94f7499e4536ec695cef11d90c928ba25a1a486d7622efcb6b2": "0x000000000000000000000000000000000000000000000000000000000000000d", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ada": "0x0000000000000000000000006e28e5af24da4cb7bd669332244271edce95f747", + "0x845fe36df89f33549d4d9e35ad576112e9e917867e6cbe74d879df2d6df170fd": "0x000000000000000000000000000000000000000000000000000000000000000e", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5adb": "0x0000000000000000000000005ed4f15045acfdd0392a7a0706503ae1aa2b82dc", + "0x554c9763690a194d93da35c9c8b7b8ee8cf1bbea47e3bddc1214d6936f97f884": "0x000000000000000000000000000000000000000000000000000000000000000f", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5adc": "0x0000000000000000000000005646b6e8a0856766f0ace6d008f6919ad42df82c", + "0x18b7db32de9c657e0f347513acd182bb516c87519164da1324adf4edf014a712": "0x0000000000000000000000000000000000000000000000000000000000000010", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5add": "0x000000000000000000000000025e6bec8c34dbb38120840610004e8968790b7e", + "0x406d0846c6d5faa82da035935dc91b86223ccc60c6caa9c664bbbd5a5de94c81": "0x0000000000000000000000000000000000000000000000000000000000000011", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ade": "0x000000000000000000000000b441a6a51bf69366d903c072d3b5594ca02ff1e0", + "0x2e7ba3cd568c7a118170cd80621050d3139bd402c68ffaee7ed868edaee1f332": "0x0000000000000000000000000000000000000000000000000000000000000012", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5adf": "0x000000000000000000000000362ee93c00d8bffc1e0284116d7cc9513cde959f", + "0x050bc4fde8db632a0535e882d31d73ed5491effa4c77814df0961c5574ab75a2": "0x0000000000000000000000000000000000000000000000000000000000000013", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ae0": "0x000000000000000000000000272d6bd040c2b8454f4f6f43115758fbe318ee2c", + "0x78be96c8b5a09c5148cbf857c627a418834302c044965eac8208c8d90f96329f": "0x0000000000000000000000000000000000000000000000000000000000000014", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ae1": "0x00000000000000000000000080e358cbb533f6c8d07d2dc5604a55aa925a95df", + "0x98a60f9db7457ed96d805174815e1f86b0abb3413c3a831168b5bf13dc7ef1c3": "0x0000000000000000000000000000000000000000000000000000000000000015", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ae2": "0x000000000000000000000000fcb42091acbef803e333a1b5c7079a43b0cfde59", + "0xc1068d85f4efbae88bb6f3da323b02c948c855b42fc028bff9bcb076d2b4ce7e": "0x0000000000000000000000000000000000000000000000000000000000000016", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ae3": "0x000000000000000000000000aaf5a641256131484d00acc565d84683025f2444", + "0x2c5fac4b9226ae5fb6d776b6fbfc33bcc1139ec3cd2695aa5c60609592c73cb9": "0x0000000000000000000000000000000000000000000000000000000000000017", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ae4": "0x00000000000000000000000018050b80d427b373c96ab24b78996310c0733c13", + "0x40caf924e9b56b755e777382d08f2b787338ed1a0e45d325be731429381b8d6e": "0x0000000000000000000000000000000000000000000000000000000000000018", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ae5": "0x0000000000000000000000004e5963c92bfe4de6f319b0859b2efcf95267e3ae", + } + case params.OasysTestnetGenesisHash: + contracts["0x520000000000000000000000000000000000002D"].storage = map[string]string{ + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000520000000000000000000000000000000000002e", + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xdbb60c4c5115f553b8a53798dc2c469d669c9be92f354c3449cd51d3e7904fae": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace": "0x000000000000000000000000f886672205399c186638abfa9dc155dee9cbbd2e", + } + default: + contracts["0x520000000000000000000000000000000000002D"].storage = map[string]string{ + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000520000000000000000000000000000000000002e", + } + } + + // StakeManager + contracts["0x0000000000000000000000000000000000001001"].codeHash = "538e6305e43adbe04123a3833f17f0a6" + contracts["0x0000000000000000000000000000000000001001"].storage = map[string]string{ + "0x09": "0x000000000000000000000000520000000000000000000000000000000000002e", + } +} + func TestDeploy(t *testing.T) { type wantDeployments []struct { block uint64 @@ -823,6 +1042,7 @@ func TestDeploy(t *testing.T) { {419000, []deployFn{_deployments5}}, {557100, []deployFn{_deployments6}}, {971800, []deployFn{_deployments7}}, + {1529980, []deployFn{_deployments9}}, }, }, { @@ -838,6 +1058,7 @@ func TestDeploy(t *testing.T) { {385000, []deployFn{_deployments5}}, {546400, []deployFn{_deployments6}}, {955400, []deployFn{_deployments7, _deployments8}}, + {1519840, []deployFn{_deployments9}}, }, }, { @@ -845,14 +1066,18 @@ func TestDeploy(t *testing.T) { common.Hash{}, wantContracts{}, wantDeployments{ - {1, []deployFn{_deployments0}}, - {2, []deployFn{_deployments1}}, - {3, []deployFn{_deployments2}}, - {4, []deployFn{_deployments3}}, - {5, []deployFn{_deployments4}}, - {6, []deployFn{_deployments5}}, - {7, []deployFn{_deployments6}}, - {8, []deployFn{_deployments7, _deployments8}}, + {2, []deployFn{ + _deployments0, + _deployments1, + _deployments2, + _deployments3, + _deployments4, + _deployments5, + _deployments6, + _deployments7, + _deployments8, + _deployments9, + }}, }, }, } @@ -914,5 +1139,4 @@ func TestDeploy(t *testing.T) { } } } - } diff --git a/params/config.go b/params/config.go index 517c1c90b..d620f759f 100644 --- a/params/config.go +++ b/params/config.go @@ -267,6 +267,7 @@ var ( MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), + Oasys: &OasysConfig{ Period: 15, Epoch: 5760, @@ -286,6 +287,7 @@ var ( MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), + Oasys: &OasysConfig{ Period: 15, Epoch: 5760, @@ -306,12 +308,6 @@ var ( // adding flags to the config to also have to set these fields. AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}, nil} - // AllOasysProtocolChanges contains every protocol change (EIPs) introduced. - // - // This configuration is intentionally not using keyed fields to force anyone - // adding flags to the config to also have to set these fields. - AllOasysProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, &OasysConfig{Period: 0, Epoch: 30000}} - TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil, nil} TestRules = TestChainConfig.Rules(new(big.Int), false) ) @@ -447,7 +443,7 @@ func (c *ChainConfig) String() string { default: engine = "unknown" } - return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, MergeFork: %v, Engine: %v}", + return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, MergeFork: %v, OasysPublication: %v, Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -464,6 +460,7 @@ func (c *ChainConfig) String() string { c.LondonBlock, c.ArrowGlacierBlock, c.MergeForkBlock, + c.OasysPublicationBlock(), engine, ) } @@ -535,6 +532,30 @@ func (c *ChainConfig) IsArrowGlacier(num *big.Int) bool { return isForked(c.ArrowGlacierBlock, num) } +// OasysPublicationBlock returns the hard fork of Oasys. +func (c *ChainConfig) OasysPublicationBlock() *big.Int { + if c.Oasys == nil { + return nil + } + if c.ChainID.Cmp(OasysMainnetChainConfig.ChainID) == 0 { + return big.NewInt(1529980) + } + if c.ChainID.Cmp(OasysTestnetChainConfig.ChainID) == 0 { + return big.NewInt(1519840) + } + return big.NewInt(2) +} + +// IsOasysPublication returns true if num is equal to or greater than the Oasys hard fork block. +func (c *ChainConfig) IsForkedOasysPublication(num *big.Int) bool { + return isForked(c.OasysPublicationBlock(), num) +} + +// IsOasysPublication returns true if num is equal to than the Oasys Publication fork block. +func (c *ChainConfig) IsOnOasysPublication(num *big.Int) bool { + return configNumEqual(c.OasysPublicationBlock(), num) +} + // IsTerminalPoWBlock returns whether the given block is the last block of PoW stage. func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *big.Int) bool { if c.TerminalTotalDifficulty == nil { diff --git a/params/version.go b/params/version.go index 357eb0f2e..653e7cf3d 100644 --- a/params/version.go +++ b/params/version.go @@ -22,8 +22,8 @@ import ( const ( VersionMajor = 1 // Major version component of the current release - VersionMinor = 0 // Minor version component of the current release - VersionPatch = 6 // Patch version component of the current release + VersionMinor = 1 // Minor version component of the current release + VersionPatch = 0 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )