|
|
|
// Copyright 2017 The go-ethereum Authors
|
|
|
|
// This file is part of the go-ethereum library.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
package tracers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"math/big"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/rlp"
|
|
|
|
"github.com/harmony-one/harmony/core/vm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type action struct {
|
|
|
|
op vm.OpCode
|
|
|
|
from common.Address
|
|
|
|
to common.Address
|
|
|
|
input []byte
|
|
|
|
output []byte
|
|
|
|
gasIn uint64
|
|
|
|
gasCost uint64
|
|
|
|
gas uint64
|
|
|
|
gasUsed uint64
|
|
|
|
outOff int64
|
|
|
|
outLen int64
|
|
|
|
value *big.Int
|
|
|
|
err error
|
|
|
|
revert []byte
|
|
|
|
subCalls []*action
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *action) push(ac *action) {
|
|
|
|
c.subCalls = append(c.subCalls, ac)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *action) fromStorage(blockStorage *TraceBlockStorage, acStorage *ActionStorage) {
|
|
|
|
|
|
|
|
c.op = vm.OpCode(acStorage.readByte())
|
|
|
|
errByte := acStorage.readByte()
|
|
|
|
if errByte != 0 {
|
|
|
|
revertIndex := int(acStorage.readNumber().Int64())
|
|
|
|
c.revert = blockStorage.getData(revertIndex)
|
|
|
|
c.err = errors.New("Reverted")
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.op == vm.CREATE || c.op == vm.CREATE2 {
|
|
|
|
fromIndex := int(acStorage.readNumber().Int64())
|
|
|
|
toIndex := int(acStorage.readNumber().Int64())
|
|
|
|
c.value = acStorage.readNumber()
|
|
|
|
inputIndex := int(acStorage.readNumber().Int64())
|
|
|
|
outputIndex := int(acStorage.readNumber().Int64())
|
|
|
|
c.gas = acStorage.readNumber().Uint64()
|
|
|
|
c.gasUsed = acStorage.readNumber().Uint64()
|
|
|
|
|
|
|
|
c.from = blockStorage.getAddress(fromIndex)
|
|
|
|
c.to = blockStorage.getAddress(toIndex)
|
|
|
|
c.input = blockStorage.getData(inputIndex)
|
|
|
|
c.output = blockStorage.getData(outputIndex)
|
|
|
|
}
|
|
|
|
if c.op == vm.CALL || c.op == vm.CALLCODE || c.op == vm.DELEGATECALL || c.op == vm.STATICCALL {
|
|
|
|
fromIndex := int(acStorage.readNumber().Int64())
|
|
|
|
toIndex := int(acStorage.readNumber().Int64())
|
|
|
|
c.value = acStorage.readNumber()
|
|
|
|
inputIndex := int(acStorage.readNumber().Int64())
|
|
|
|
outputIndex := int(acStorage.readNumber().Int64())
|
|
|
|
c.gas = acStorage.readNumber().Uint64()
|
|
|
|
c.gasUsed = acStorage.readNumber().Uint64()
|
|
|
|
|
|
|
|
c.from = blockStorage.getAddress(fromIndex)
|
|
|
|
c.to = blockStorage.getAddress(toIndex)
|
|
|
|
c.input = blockStorage.getData(inputIndex)
|
|
|
|
c.output = blockStorage.getData(outputIndex)
|
|
|
|
}
|
|
|
|
if c.op == vm.SELFDESTRUCT {
|
|
|
|
fromIndex := int(acStorage.readNumber().Int64())
|
|
|
|
toIndex := int(acStorage.readNumber().Int64())
|
|
|
|
c.from = blockStorage.getAddress(fromIndex)
|
|
|
|
c.to = blockStorage.getAddress(toIndex)
|
|
|
|
c.value = acStorage.readNumber()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c action) toStorage(blockStorage *TraceBlockStorage) *ActionStorage {
|
|
|
|
acStorage := &ActionStorage{
|
|
|
|
TraceData: make([]byte, 0, 1024),
|
|
|
|
}
|
|
|
|
|
|
|
|
acStorage.appendByte(byte(c.op))
|
|
|
|
var errByte byte
|
|
|
|
if c.err != nil {
|
|
|
|
errByte = 1
|
|
|
|
}
|
|
|
|
acStorage.appendByte(errByte)
|
|
|
|
if errByte != 0 {
|
|
|
|
revertIndex := blockStorage.indexData(c.revert)
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(revertIndex)))
|
|
|
|
}
|
|
|
|
if c.op == vm.CREATE || c.op == vm.CREATE2 {
|
|
|
|
fromIndex := blockStorage.indexAddress(c.from)
|
|
|
|
toIndex := blockStorage.indexAddress(c.to)
|
|
|
|
inputIndex := blockStorage.indexData(c.input)
|
|
|
|
outputIndex := blockStorage.indexData(c.output)
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(fromIndex)))
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(toIndex)))
|
|
|
|
acStorage.appendNumber(c.value)
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(inputIndex)))
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(outputIndex)))
|
|
|
|
acStorage.appendNumber((&big.Int{}).SetUint64(c.gas))
|
|
|
|
acStorage.appendNumber((&big.Int{}).SetUint64(c.gasUsed))
|
|
|
|
return acStorage
|
|
|
|
}
|
|
|
|
if c.op == vm.CALL || c.op == vm.CALLCODE || c.op == vm.DELEGATECALL || c.op == vm.STATICCALL {
|
|
|
|
if c.value == nil {
|
|
|
|
c.value = big.NewInt(0)
|
|
|
|
}
|
|
|
|
fromIndex := blockStorage.indexAddress(c.from)
|
|
|
|
toIndex := blockStorage.indexAddress(c.to)
|
|
|
|
inputIndex := blockStorage.indexData(c.input)
|
|
|
|
outputIndex := blockStorage.indexData(c.output)
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(fromIndex)))
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(toIndex)))
|
|
|
|
acStorage.appendNumber(c.value)
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(inputIndex)))
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(outputIndex)))
|
|
|
|
acStorage.appendNumber((&big.Int{}).SetUint64(c.gas))
|
|
|
|
acStorage.appendNumber((&big.Int{}).SetUint64(c.gasUsed))
|
|
|
|
return acStorage
|
|
|
|
}
|
|
|
|
if c.op == vm.SELFDESTRUCT {
|
|
|
|
fromIndex := blockStorage.indexAddress(c.from)
|
|
|
|
toIndex := blockStorage.indexAddress(c.to)
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(fromIndex)))
|
|
|
|
acStorage.appendNumber(big.NewInt(int64(toIndex)))
|
|
|
|
acStorage.appendNumber(c.value)
|
|
|
|
return acStorage
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c action) toJsonStr() (string, *string, *string) {
|
|
|
|
callType := strings.ToLower(c.op.String())
|
|
|
|
if c.op == vm.CREATE || c.op == vm.CREATE2 {
|
|
|
|
action := fmt.Sprintf(
|
|
|
|
`{"from":"0x%x","gas":"0x%x","init":"0x%x","value":"0x%s"}`,
|
|
|
|
c.from, c.gas, c.input, c.value.Text(16),
|
|
|
|
)
|
|
|
|
output := fmt.Sprintf(
|
|
|
|
`{"address":"0x%x","code":"0x%x","gasUsed":"0x%x"}`,
|
|
|
|
c.to, c.output, c.gasUsed,
|
|
|
|
)
|
|
|
|
return "create", &action, &output
|
|
|
|
}
|
|
|
|
if c.op == vm.CALL || c.op == vm.CALLCODE || c.op == vm.DELEGATECALL || c.op == vm.STATICCALL {
|
|
|
|
if c.value == nil {
|
|
|
|
c.value = big.NewInt(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
var valueStr string
|
|
|
|
if c.op != vm.STATICCALL && c.op != vm.DELEGATECALL {
|
|
|
|
valueStr = fmt.Sprintf(`,"value":"0x%s"`, c.value.Text(16))
|
|
|
|
}
|
|
|
|
|
|
|
|
action := fmt.Sprintf(
|
|
|
|
`{"callType":"%s"%s,"to":"0x%x","gas":"0x%x","from":"0x%x","input":"0x%x"}`,
|
|
|
|
callType, valueStr, c.to, c.gas, c.from, c.input,
|
|
|
|
)
|
|
|
|
|
|
|
|
output := fmt.Sprintf(
|
|
|
|
`{"output":"0x%x","gasUsed":"0x%x"}`,
|
|
|
|
c.output, c.gasUsed,
|
|
|
|
)
|
|
|
|
return "call", &action, &output
|
|
|
|
}
|
|
|
|
if c.op == vm.SELFDESTRUCT {
|
|
|
|
action := fmt.Sprintf(
|
|
|
|
`{"refundAddress":"0x%x","balance":"0x%s","address":"0x%x"}`,
|
|
|
|
c.to, c.value.Text(16), c.from,
|
|
|
|
)
|
|
|
|
return "suicide", &action, nil
|
|
|
|
}
|
|
|
|
return "unkonw", nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ParityTxTracer struct {
|
|
|
|
blockNumber uint64
|
|
|
|
blockHash common.Hash
|
|
|
|
transactionPosition uint64
|
|
|
|
transactionHash common.Hash
|
|
|
|
descended bool
|
|
|
|
calls []*action
|
|
|
|
action
|
|
|
|
}
|
|
|
|
type ParityBlockTracer struct {
|
|
|
|
Hash common.Hash
|
|
|
|
Number uint64
|
|
|
|
cur *ParityTxTracer
|
|
|
|
tracers []*ParityTxTracer
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptt *ParityTxTracer) push(ac *action) {
|
|
|
|
ptt.calls = append(ptt.calls, ac)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptt *ParityTxTracer) pop() *action {
|
|
|
|
popIndex := len(ptt.calls) - 1
|
|
|
|
ac := ptt.calls[popIndex]
|
|
|
|
ptt.calls = ptt.calls[:popIndex]
|
|
|
|
return ac
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptt *ParityTxTracer) last() *action {
|
|
|
|
return ptt.calls[len(ptt.calls)-1]
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptt *ParityTxTracer) len() int {
|
|
|
|
return len(ptt.calls)
|
|
|
|
}
|
|
|
|
|
|
|
|
// CaptureStart implements the ParityBlockTracer interface to initialize the tracing operation.
|
|
|
|
func (jst *ParityBlockTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) error {
|
|
|
|
jst.cur = &ParityTxTracer{}
|
|
|
|
jst.cur.op = vm.CALL // vritual call
|
|
|
|
if create {
|
|
|
|
jst.cur.op = vm.CREATE // virtual create
|
|
|
|
}
|
|
|
|
jst.cur.from = from
|
|
|
|
jst.cur.to = to
|
|
|
|
jst.cur.input = input
|
|
|
|
jst.cur.gas = gas
|
|
|
|
jst.cur.value = (&big.Int{}).Set(value)
|
|
|
|
jst.cur.blockHash = env.StateDB.BlockHash()
|
|
|
|
jst.cur.transactionPosition = uint64(env.StateDB.TxIndex())
|
|
|
|
jst.cur.transactionHash = env.StateDB.TxHashETH()
|
|
|
|
jst.cur.blockNumber = env.BlockNumber.Uint64()
|
|
|
|
jst.cur.descended = false
|
|
|
|
jst.cur.push(&jst.cur.action)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// CaptureState implements the ParityBlockTracer interface to trace a single step of VM execution.
|
|
|
|
func (jst *ParityBlockTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, stack *vm.Stack, contract *vm.Contract, depth int, err error) (vm.HookAfter, error) {
|
|
|
|
if err != nil {
|
|
|
|
return nil, jst.CaptureFault(env, pc, op, gas, cost, memory, stack, contract, depth, err)
|
|
|
|
}
|
|
|
|
var retErr error
|
|
|
|
stackPeek := func(n int) *big.Int {
|
|
|
|
if n >= len(stack.Data()) {
|
|
|
|
retErr = errors.New("tracer bug:stack overflow")
|
|
|
|
return big.NewInt(0)
|
|
|
|
}
|
|
|
|
return stack.Back(n)
|
|
|
|
}
|
|
|
|
memoryCopy := func(off, size int64) []byte {
|
|
|
|
if off+size > int64(memory.Len()) {
|
|
|
|
retErr = errors.New("tracer bug:memory leak")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return memory.GetCopy(off, size)
|
|
|
|
}
|
|
|
|
|
|
|
|
switch op {
|
|
|
|
case vm.CREATE, vm.CREATE2:
|
|
|
|
inOff := stackPeek(1).Int64()
|
|
|
|
inSize := stackPeek(2).Int64()
|
|
|
|
jst.cur.push(&action{
|
|
|
|
op: op,
|
|
|
|
from: contract.Address(),
|
|
|
|
input: memoryCopy(inOff, inSize),
|
|
|
|
gasIn: gas,
|
|
|
|
gasCost: cost,
|
|
|
|
value: (&big.Int{}).Set(stackPeek(0)),
|
|
|
|
})
|
|
|
|
jst.cur.descended = true
|
|
|
|
return nil, retErr
|
|
|
|
case vm.SELFDESTRUCT:
|
|
|
|
ac := jst.cur.last()
|
|
|
|
ac.push(&action{
|
|
|
|
op: op,
|
|
|
|
from: contract.Address(),
|
|
|
|
to: common.BigToAddress(stackPeek(0)),
|
|
|
|
gasIn: gas,
|
|
|
|
gasCost: cost,
|
|
|
|
value: env.StateDB.GetBalance(contract.Address()),
|
|
|
|
})
|
|
|
|
return nil, retErr
|
|
|
|
case vm.CALL, vm.CALLCODE, vm.DELEGATECALL, vm.STATICCALL:
|
|
|
|
to := common.BigToAddress(stackPeek(1))
|
|
|
|
precompiles := vm.PrecompiledContractsVRF
|
|
|
|
if _, exist := precompiles[to]; exist {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
off := 1
|
|
|
|
if op == vm.DELEGATECALL || op == vm.STATICCALL {
|
|
|
|
off = 0
|
|
|
|
}
|
|
|
|
inOff := stackPeek(2 + off).Int64()
|
|
|
|
inSize := stackPeek(3 + off).Int64()
|
|
|
|
callObj := &action{
|
|
|
|
op: op,
|
|
|
|
from: contract.Address(),
|
|
|
|
to: to,
|
|
|
|
input: memoryCopy(inOff, inSize),
|
|
|
|
gasIn: gas,
|
|
|
|
gasCost: cost,
|
|
|
|
outOff: stackPeek(4 + off).Int64(),
|
|
|
|
outLen: stackPeek(5 + off).Int64(),
|
|
|
|
}
|
|
|
|
if op != vm.DELEGATECALL && op != vm.STATICCALL {
|
|
|
|
callObj.value = (&big.Int{}).Set(stackPeek(2))
|
|
|
|
}
|
|
|
|
jst.cur.push(callObj)
|
|
|
|
jst.cur.descended = true
|
|
|
|
return nil, retErr
|
|
|
|
}
|
|
|
|
|
|
|
|
if jst.cur.descended {
|
|
|
|
jst.cur.descended = false
|
|
|
|
if depth >= jst.cur.len() { // >= to >
|
|
|
|
jst.cur.last().gas = gas
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if op == vm.REVERT {
|
|
|
|
last := jst.cur.last()
|
|
|
|
last.err = errors.New("execution reverted")
|
|
|
|
revertOff := stackPeek(0).Int64()
|
|
|
|
revertLen := stackPeek(1).Int64()
|
|
|
|
last.revert = memoryCopy(revertOff, revertLen)
|
|
|
|
return nil, retErr
|
|
|
|
}
|
|
|
|
if depth == jst.cur.len()-1 { // depth == len - 1
|
|
|
|
call := jst.cur.pop()
|
|
|
|
if call.op == vm.CREATE || call.op == vm.CREATE2 {
|
|
|
|
call.gasUsed = call.gasIn - call.gasCost - gas
|
|
|
|
|
|
|
|
ret := stackPeek(0)
|
|
|
|
if ret.Sign() != 0 {
|
|
|
|
call.to = common.BigToAddress(ret)
|
Release Candidate 2023.2.0 ( dev -> main ) (#4399)
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
* Configurable tx pool. (#4240)
* AccountQueue & GlobalQueue.
* Lifetime duration.
* [pool] make flags configurable
* [pool] use 4096 as default `GlobalSlots`
* [rosetta] update default values of tx pool
* [test] update value to default
* PriceLimit and PriceBump.
* Fix tests.
* Fix price limit & bump.
* Updated, fixed migrate version and tests.
* Rebased.
* Fix go toml version.
---------
Co-authored-by: Konstantin <k.potapov@softpro.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
* Upgrade rawdb and statedb codes to add the latest functionalities of ethdb (#4374)
* added bloom filter
* upgrade rawdb and statedb
* change var name and remove extra comments
* return back fake storage in case if we need it for test later
* add the previous change back
* remove some extra entries from go.mod
* fix WritePreimages to use batch
* mark unused functions which are ported over from eth
---------
Co-authored-by: Casey Gardiner <117784577+ONECasey@users.noreply.github.com>
* update all ethereum rawdb pointers to use harmony rawdb (#4395)
* Fix reduce node dependencies. (#4379)
* Fix.
* Fix.
* Fix pool init.
* Clean up.
* add prefix for contract code (#4397)
* Rotate external validators for non-beacon shards. (#4373)
* Rotate only non beacon shards.
* Rotate all shards, but only hmy validators for beacon.
* Fix type.
* Revert "Fix type."
This reverts commit 0a8b506c763d9f8609abff7395ba32b18e43b149.
* Revert "Rotate all shards, but only hmy validators for beacon."
This reverts commit 70b09e2de81aa2cbffae3ccdfd4e334e7d938759.
* Fixed failed test.
* Revert "Revert "Rotate all shards, but only hmy validators for beacon.""
This reverts commit 66cfaa9817488be60ed5b5cfee1fe833ede237c8.
* Frequency by slots count.
* Fix config.
* First validator produce rest blocks.
* Updated.
* Add lock.
* Add prefix for validator wrapper (#4402)
* add separate prefix for validator wrapper
* update comments
* make read/write backward compatible
* add validator codes to stats
* goimports
* goimports accessor_state
* add snapshot feature to state db (#4406)
* Typed cache & Node cleanup. (#4409)
* Channels usage through methods.
* Fix retry count. Removed proposedBlock.
* keysToAddrs rewritten to lrucache.
* core, internal/configs: HIP28-v2 fee collection (#4410)
* core, internal/configs: HIP28-v2 fee collection
Based on the Snapshot vote that has passed, collect 50% of the fee to a
community maintained account and the remainder to an account used to pay
for infrastructure costs. Note that these accounts need to be decided
and set in the code at this moment, and the feature needs to be
activated by setting the `FeeCollectEpoch` of the `ChainConfig` object.
The implementation for devnet is a bit different than compared to
others because the feature was activated on devnet with 100% collection
to an account. I have handled this case separately in `devnet.go`.
* test: add test for StateTransition.ApplyMessage
The objective of this unit test is to check that the fees of a
transaction are appropriately credited to the fee collectors that are
set. This means, for a transaction of 21,000 gas limit and 100 gwei gas
price, two equal fee collectors get 10,500 * 100 gwei each. In addition,
to be clear that the refund mechanism (in case a transaction with extra
gas comes in) works, the tested transaction has a 50,000 gas limit of
which only 21,000 gas limit is actually consumed.
* sharding/config: clarify local fee collector pk
* sharding/config: set testnet fee collector same as devnet
* test: add test for truncated fee distribution
* sharding/config: set fee collector addresses
* test: hardcode the expected fee collected
* goimports
* params/config: set testnet fee collect epoch
Schedule testnet hard fork epoch to be 1296, which begins around the
time 2023-04-28 07:14:20+00:00
* params/config: schedule devnee fee collection
Signed-off-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
* Minor: removed time.Sleep from tests. (#4412)
* Provide current time as argument.
* Fix test.
* Fix naming.
* Mainnet Release Candidate 2023.1.2 (#4376) (#4414)
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Bump github.com/aws/aws-sdk-go from 1.33.0 to 1.34.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.34.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.33.0...v1.34.0)
---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
dependency-type: direct:production
...
* Bump github.com/ipld/go-ipld-prime from 0.9.0 to 0.19.0
Bumps [github.com/ipld/go-ipld-prime](https://github.com/ipld/go-ipld-prime) from 0.9.0 to 0.19.0.
- [Release notes](https://github.com/ipld/go-ipld-prime/releases)
- [Changelog](https://github.com/ipld/go-ipld-prime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ipld/go-ipld-prime/compare/v0.9.0...v0.19.0)
---
updated-dependencies:
- dependency-name: github.com/ipld/go-ipld-prime
dependency-type: indirect
...
* Bump golang.org/x/net from 0.3.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.3.0...v0.7.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: indirect
...
* Small fixes.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Casey Gardiner <117784577+ONECasey@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
* chore: merge `main` into `dev` (#4415)
* Mainnet Release Candidate 2023.1.2 (#4376)
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Bump github.com/aws/aws-sdk-go from 1.33.0 to 1.34.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.34.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.33.0...v1.34.0)
---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump github.com/ipld/go-ipld-prime from 0.9.0 to 0.19.0
Bumps [github.com/ipld/go-ipld-prime](https://github.com/ipld/go-ipld-prime) from 0.9.0 to 0.19.0.
- [Release notes](https://github.com/ipld/go-ipld-prime/releases)
- [Changelog](https://github.com/ipld/go-ipld-prime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ipld/go-ipld-prime/compare/v0.9.0...v0.19.0)
---
updated-dependencies:
- dependency-name: github.com/ipld/go-ipld-prime
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump golang.org/x/net from 0.3.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.3.0...v0.7.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Small fixes.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
* build: update pinned curl version (#4394)
Per the Alpine Linux package repositories, the version for cURL included
with v3.16 has changed to revision 6
* consensus: replace type assert with test (#4398)
If `consensus.finalityCounter` does not have anything stored (for
example in Syncing mode), the `Load()` returns an interface that cannot
be automatically asserted to an `int64`. This results in the node
crashing. This commit fixes that.
* Turn pprof default on with local saved files (#3894)
* Turn pprof default on with local saved files
* [pprof] change interval from 600s to 3600s
* Revert "Turn pprof default on with local saved files (#3894)" (#4400)
This reverts commit 78d26d7910a58ded3bfe689b3de07ea28d95d7d5.
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Casey Gardiner <117784577+ONECasey@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
Co-authored-by: Jacky Wang <jackyw.se@gmail.com>
* internal/params: set validator code fix hard forks (#4413)
* internal/params: schedule hard forks
Signed-off-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
* internal/params: set localnet fee collect epoch 2
Signed-off-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
---------
Signed-off-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
* internal/params: schedule HIP28v2 + val code fix (#4416)
Signed-off-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
* Dev fix conflicts. (#4417)
* Mainnet Release Candidate 2023.1.2 (#4376)
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Bump github.com/aws/aws-sdk-go from 1.33.0 to 1.34.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.34.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.33.0...v1.34.0)
---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump github.com/ipld/go-ipld-prime from 0.9.0 to 0.19.0
Bumps [github.com/ipld/go-ipld-prime](https://github.com/ipld/go-ipld-prime) from 0.9.0 to 0.19.0.
- [Release notes](https://github.com/ipld/go-ipld-prime/releases)
- [Changelog](https://github.com/ipld/go-ipld-prime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ipld/go-ipld-prime/compare/v0.9.0...v0.19.0)
---
updated-dependencies:
- dependency-name: github.com/ipld/go-ipld-prime
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump golang.org/x/net from 0.3.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.3.0...v0.7.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Small fixes.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
* build: update pinned curl version (#4394)
Per the Alpine Linux package repositories, the version for cURL included
with v3.16 has changed to revision 6
* consensus: replace type assert with test (#4398)
If `consensus.finalityCounter` does not have anything stored (for
example in Syncing mode), the `Load()` returns an interface that cannot
be automatically asserted to an `int64`. This results in the node
crashing. This commit fixes that.
* Turn pprof default on with local saved files (#3894)
* Turn pprof default on with local saved files
* [pprof] change interval from 600s to 3600s
* Revert "Turn pprof default on with local saved files (#3894)" (#4400)
This reverts commit 78d26d7910a58ded3bfe689b3de07ea28d95d7d5.
* go mod tidy.
* Increased wait time.
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Casey Gardiner <117784577+ONECasey@users.noreply.github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
Co-authored-by: Jacky Wang <jackyw.se@gmail.com>
---------
Signed-off-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
Co-authored-by: Konstantin <k.potapov@softpro.com>
Co-authored-by: Gheis Mohammadi <Gheis.Mohammadi@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jacky Wang <jackyw.se@gmail.com>
2 years ago
|
|
|
call.output = env.StateDB.GetCode(call.to, false)
|
|
|
|
} else if call.err == nil {
|
|
|
|
call.err = errors.New("internal failure")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if call.gas != 0 {
|
|
|
|
call.gasUsed = call.gasIn - call.gasCost + call.gas - gas
|
|
|
|
}
|
|
|
|
ret := stackPeek(0)
|
|
|
|
if ret.Sign() != 0 {
|
|
|
|
call.output = memoryCopy(call.outOff, call.outLen)
|
|
|
|
} else if call.err == nil {
|
|
|
|
call.err = errors.New("internal failure")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jst.cur.last().push(call)
|
|
|
|
}
|
|
|
|
return nil, retErr
|
|
|
|
}
|
|
|
|
|
|
|
|
// CaptureFault implements the ParityBlockTracer interface to trace an execution fault
|
|
|
|
// while running an opcode.
|
|
|
|
func (jst *ParityBlockTracer) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, stack *vm.Stack, contract *vm.Contract, depth int, err error) error {
|
|
|
|
if jst.cur.last().err != nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
call := jst.cur.pop()
|
|
|
|
call.err = err
|
|
|
|
// Consume all available gas and clean any leftovers
|
|
|
|
if call.gas != 0 {
|
|
|
|
call.gas = gas
|
|
|
|
call.gasUsed = call.gas
|
|
|
|
}
|
|
|
|
|
|
|
|
// Flatten the failed call into its parent
|
|
|
|
if jst.cur.len() > 0 {
|
|
|
|
jst.cur.last().push(call)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
jst.cur.push(call)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// CaptureEnd is called after the call finishes to finalize the tracing.
|
|
|
|
func (jst *ParityBlockTracer) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error {
|
|
|
|
jst.cur.output = output
|
|
|
|
jst.cur.gasUsed = gasUsed
|
|
|
|
if err != nil {
|
|
|
|
jst.cur.err = err
|
|
|
|
}
|
|
|
|
jst.tracers = append(jst.tracers, jst.cur)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// get TraceBlockStorage from tracer, then store it to db
|
|
|
|
func (jst *ParityBlockTracer) GetStorage() *TraceBlockStorage {
|
|
|
|
blockStorage := &TraceBlockStorage{
|
|
|
|
Hash: jst.Hash,
|
|
|
|
Number: jst.Number,
|
|
|
|
addressIndex: make(map[common.Address]int),
|
|
|
|
dataIndex: make(map[common.Hash]int),
|
|
|
|
}
|
|
|
|
txStorage := &TxStorage{
|
|
|
|
Storages: make([]*ActionStorage, 0, 1024),
|
|
|
|
}
|
|
|
|
var finalize func(ac *action, traceAddress []uint)
|
|
|
|
finalize = func(ac *action, traceAddress []uint) {
|
|
|
|
acStorage := ac.toStorage(blockStorage)
|
|
|
|
acStorage.Subtraces = uint(len(ac.subCalls))
|
|
|
|
acStorage.TraceAddress = make([]uint, len(traceAddress))
|
|
|
|
copy(acStorage.TraceAddress, traceAddress)
|
|
|
|
txStorage.Storages = append(txStorage.Storages, acStorage)
|
|
|
|
for i, subAc := range ac.subCalls {
|
|
|
|
finalize(subAc, append(traceAddress[:], uint(i)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, curTx := range jst.tracers {
|
|
|
|
root := &curTx.action
|
|
|
|
txStorage.Hash = curTx.transactionHash
|
|
|
|
txStorage.Storages = txStorage.Storages[:0]
|
|
|
|
finalize(root, make([]uint, 0))
|
|
|
|
b, _ := rlp.EncodeToBytes(txStorage)
|
|
|
|
blockStorage.TraceStorages = append(blockStorage.TraceStorages, b)
|
|
|
|
}
|
|
|
|
return blockStorage
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetResult calls the Javascript 'result' function and returns its value, or any accumulated error
|
|
|
|
func (jst *ParityBlockTracer) GetResult() ([]json.RawMessage, error) {
|
|
|
|
var results []json.RawMessage
|
|
|
|
var err error
|
|
|
|
var headPiece string
|
|
|
|
var finalize func(ac *action, traceAddress []int)
|
|
|
|
finalize = func(ac *action, traceAddress []int) {
|
|
|
|
typStr, acStr, outStr := ac.toJsonStr()
|
|
|
|
if acStr == nil {
|
|
|
|
err = errors.New("tracer internal failure")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
traceStr, _ := json.Marshal(traceAddress)
|
|
|
|
bodyPiece := fmt.Sprintf(
|
|
|
|
`,"subtraces":%d,"traceAddress":%s,"type":"%s","action":%s`,
|
|
|
|
len(ac.subCalls), string(traceStr), typStr, *acStr,
|
|
|
|
)
|
|
|
|
var resultPiece string
|
|
|
|
if ac.err != nil {
|
|
|
|
resultPiece = fmt.Sprintf(`,"error":"Reverted","revert":"0x%x"`, ac.revert)
|
|
|
|
|
|
|
|
} else if outStr != nil {
|
|
|
|
resultPiece = fmt.Sprintf(`,"result":%s`, *outStr)
|
|
|
|
} else {
|
|
|
|
resultPiece = `,"result":null`
|
|
|
|
}
|
|
|
|
|
|
|
|
jstr := "{" + headPiece + bodyPiece + resultPiece + "}"
|
|
|
|
results = append(results, json.RawMessage(jstr))
|
|
|
|
for i, subAc := range ac.subCalls {
|
|
|
|
finalize(subAc, append(traceAddress[:], i))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, curTx := range jst.tracers {
|
|
|
|
root := &curTx.action
|
|
|
|
headPiece = fmt.Sprintf(
|
|
|
|
`"blockNumber":%d,"blockHash":"%s","transactionHash":"%s","transactionPosition":%d`,
|
|
|
|
curTx.blockNumber, curTx.blockHash.Hex(), curTx.transactionHash.Hex(), curTx.transactionPosition,
|
|
|
|
)
|
|
|
|
finalize(root, make([]int, 0))
|
|
|
|
}
|
|
|
|
return results, err
|
|
|
|
}
|