Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainstream/dev' into eip2935-storagecon…
Browse files Browse the repository at this point in the history
…tract-change
  • Loading branch information
hyunsooda committed Jan 15, 2025
2 parents e617bc2 + 9a1d6e1 commit 8103dc4
Show file tree
Hide file tree
Showing 119 changed files with 1,358 additions and 5,071 deletions.
81 changes: 58 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,19 @@ commands:
os-network:
type: string
default: "linux-amd64"
is-test:
type: boolean
default: false
steps:
- checkout
- run:
name: "install darwin dependencies when package is darwin"
command: |
if [[ << parameters.os-network >> = "darwin-arm64" ]]; then
# install awscli
brew install awscli
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo softwareupdate --install-rosetta --agree-to-license
sudo installer -pkg AWSCLIV2.pkg -target /
# install golang
curl -O https://dl.google.com/go/go1.23.3.darwin-arm64.tar.gz
mkdir $HOME/go1.23.3
Expand Down Expand Up @@ -168,28 +173,32 @@ commands:
for item in kcn kpn ken; do
./build/package-<< parameters.package-type >>.sh -b $second_parameter $item
done
- run:
name: "upload << parameters.package-type >>-<<parameters.os-network >> packages to S3 repo"
command: |
source ~/.bashrc
KAIA_VERSION=$(go run build/rpm/main.go version)
PLATFORM_SUFFIX=$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)
for item in kcn kpn ken kcn-kairos kpn-kairos ken-kairos kgen kscn kbn kspn ksen homi; do
if [[ << parameters.package-type >> = "tar" ]]; then
aws s3 cp packages/${item}-v*.tar.gz s3://$FRONTEND_BUCKET/packages/kaia/$KAIA_VERSION/
elif [[ << parameters.package-type >> = "rpm" ]]; then
BINARY=$item
KAIROS=""
if [[ $BINARY = *-kairos ]]; then
BINARY="${BINARY%-kairos}"
KAIROS="-kairos"
fi
TARGET_RPM=$(find $BINARY-$PLATFORM_SUFFIX/rpmbuild/RPMS/$(uname -m)/ | awk -v pat="$BINARY(d)?$KAIROS-v" '$0~pat')
aws s3 cp $TARGET_RPM s3://$FRONTEND_BUCKET/packages/rhel/9-stream/kaia/
aws s3 cp $TARGET_RPM s3://$FRONTEND_BUCKET/packages/kaia/$KAIA_VERSION/
fi
done
- when:
condition:
not: << parameters.is-test >>
steps:
- run:
name: "upload << parameters.package-type >>-<<parameters.os-network >> packages to S3 repo"
command: |
source ~/.bashrc
KAIA_VERSION=$(go run build/rpm/main.go version)
PLATFORM_SUFFIX=$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)
for item in kcn kpn ken kcn-kairos kpn-kairos ken-kairos kgen kscn kbn kspn ksen homi; do
if [[ << parameters.package-type >> = "tar" ]]; then
aws s3 cp packages/${item}-v*.tar.gz s3://$FRONTEND_BUCKET/packages/kaia/$KAIA_VERSION/
elif [[ << parameters.package-type >> = "rpm" ]]; then
BINARY=$item
KAIROS=""
if [[ $BINARY = *-kairos ]]; then
BINARY="${BINARY%-kairos}"
KAIROS="-kairos"
fi
TARGET_RPM=$(find $BINARY-$PLATFORM_SUFFIX/rpmbuild/RPMS/$(uname -m)/ | awk -v pat="$BINARY(d)?$KAIROS-v" '$0~pat')
aws s3 cp $TARGET_RPM s3://$FRONTEND_BUCKET/packages/rhel/9-stream/kaia/
aws s3 cp $TARGET_RPM s3://$FRONTEND_BUCKET/packages/kaia/$KAIA_VERSION/
fi
done
createrepo-update:
steps:
- run:
Expand Down Expand Up @@ -475,30 +484,56 @@ jobs:
- packaging-and-upload:
os-network: "linux-amd64"
package-type: "rpm"
is-test: false
# - store_artifacts:
# path: /go/src/github.com/kaiachain/kaia/ken-linux-x86_64/rpmbuild/RPMS/x86_64/kend-v2.0.0-0.el9.x86_64.rpm
# destination: kend-v2.0.0-0.el9.x86_64.rpm
# - store_artifacts:
# path: /go/src/github.com/kaiachain/kaia/ken-linux-x86_64/rpmbuild/RPMS/x86_64/kend-kairos-v2.0.0-0.el9.x86_64.rpm
# destination: kend-kairos-v2.0.0-0.el9.x86_64.rpm
tar-linux-amd64-packaging:
executor: tar-linux-amd64-executor
steps:
- packaging-and-upload:
os-network: "linux-amd64"
package-type: "tar"
is-test: false
# - store_artifacts:
# path: packages
# destination: packages
rpm-linux-arm64-packaging:
executor: rpm-linux-arm64-executor
steps:
- packaging-and-upload:
os-network: "linux-arm64"
package-type: "rpm"
is-test: false
# - store_artifacts:
# path: /go/src/github.com/kaiachain/kaia/ken-linux-aarch64/rpmbuild/RPMS/aarch64/kend-v2.0.0-0.el9.aarch64.rpm
# destination: kend-v2.0.0-0.el9.aarch64.rpm
# - store_artifacts:
# path: /go/src/github.com/kaiachain/kaia/ken-linux-aarch64/rpmbuild/RPMS/aarch64/kend-kairos-v2.0.0-0.el9.aarch64.rpm
# destination: kend-kairos-v2.0.0-0.el9.aarch64.rpm
tar-linux-arm64-packaging:
executor: tar-linux-arm64-executor
steps:
- packaging-and-upload:
os-network: "linux-arm64"
package-type: "tar"
is-test: false
# - store_artifacts:
# path: packages
# destination: packages
tar-darwin-arm64-packaging:
executor: tar-darwin-arm64-executor
steps:
- packaging-and-upload:
os-network: "darwin-arm64"
package-type: "tar"
is-test: false
# - store_artifacts:
# path: packages
# destination: packages
deploy-rpm-public:
executor: rpm-linux-amd64-executor
steps:
Expand Down
4 changes: 2 additions & 2 deletions accounts/abi/bind/backends/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ func (b *BlockchainContractBackend) callContract(call kaia.CallMsg, block *types
if call.AccessList != nil {
accessList = *call.AccessList
}
intrinsicGas, err := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.bc.Config().Rules(block.Number()))
intrinsicGas, dataTokens, err := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.bc.Config().Rules(block.Number()))
if err != nil {
return nil, err
}

msg := types.NewMessage(call.From, call.To, 0, call.Value, call.Gas, gasPrice, nil, nil, call.Data,
false, intrinsicGas, accessList, nil)
false, intrinsicGas, dataTokens, accessList, nil)

txContext := blockchain.NewEVMTxContext(msg, block.Header(), b.bc.Config())
blockContext := blockchain.NewEVMBlockContext(block.Header(), b.bc, nil)
Expand Down
4 changes: 2 additions & 2 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ func (b *SimulatedBackend) callContract(_ context.Context, call kaia.CallMsg, bl
if call.AccessList != nil {
accessList = *call.AccessList
}
intrinsicGas, _ := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.config.Rules(block.Number()))
msg := types.NewMessage(call.From, call.To, nonce, call.Value, call.Gas, gasPrice, nil, nil, call.Data, true, intrinsicGas, accessList, nil)
intrinsicGas, dataTokens, _ := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.config.Rules(block.Number()))
msg := types.NewMessage(call.From, call.To, nonce, call.Value, call.Gas, gasPrice, nil, nil, call.Data, true, intrinsicGas, dataTokens, accessList, nil)

txContext := blockchain.NewEVMTxContext(msg, block.Header(), b.config)
blockContext := blockchain.NewEVMBlockContext(block.Header(), b.blockchain, nil)
Expand Down
10 changes: 5 additions & 5 deletions api/api_ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -1413,11 +1413,11 @@ func EthDoCall(ctx context.Context, b Backend, args EthTransactionArgs, blockNrO
} else {
baseFee = new(big.Int).SetUint64(params.ZeroBaseFee)
}
intrinsicGas, err := types.IntrinsicGas(args.data(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
intrinsicGas, dataTokens, err := types.IntrinsicGas(args.data(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
if err != nil {
return nil, err
}
msg, err := args.ToMessage(globalGasCap, baseFee, intrinsicGas)
msg, err := args.ToMessage(globalGasCap, baseFee, intrinsicGas, dataTokens)
if err != nil {
return nil, err
}
Expand All @@ -1432,7 +1432,7 @@ func EthDoCall(ctx context.Context, b Backend, args EthTransactionArgs, blockNrO
if msg.Gas() < intrinsicGas {
return nil, fmt.Errorf("%w: msg.gas %d, want %d", blockchain.ErrIntrinsicGas, msg.Gas(), intrinsicGas)
}
evm, vmError, err := b.GetEVM(ctx, msg, state, header, vm.Config{ComputationCostLimit: params.OpcodeComputationCostLimitInfinite})
evm, vmError, err := b.GetEVM(ctx, msg, state, header, vm.Config{ComputationCostLimit: params.OpcodeComputationCostLimitInfinite, UseConsoleLog: b.IsConsoleLogEnabled()})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1570,11 +1570,11 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
precompiles := vm.ActivePrecompiles(rules)

toMsg := func() (*types.Transaction, error) {
intrinsicGas, err := types.IntrinsicGas(args.data(), nil, nil, args.To == nil, rules)
intrinsicGas, dataTokens, err := types.IntrinsicGas(args.data(), nil, nil, args.To == nil, rules)
if err != nil {
return nil, err
}
return args.ToMessage(gasCap, header.BaseFee, intrinsicGas)
return args.ToMessage(gasCap, header.BaseFee, intrinsicGas, dataTokens)
}

if args.Gas == nil {
Expand Down
5 changes: 1 addition & 4 deletions api/api_ethereum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ func testGetHeader(t *testing.T, testAPIName string, config *params.ChainConfig)
// Author is called when calculates miner field of Header.
dummyMiner := common.HexToAddress("0x9712f943b296758aaae79944ec975884188d3a96")
mockEngine.EXPECT().Author(gomock.Any()).Return(dummyMiner, nil)
var dummyTotalDifficulty uint64 = 5
mockBackend.EXPECT().GetTd(gomock.Any()).Return(new(big.Int).SetUint64(dummyTotalDifficulty))

// Create dummy header
header := types.CopyHeader(&types.Header{
Expand Down Expand Up @@ -323,8 +321,6 @@ func testGetBlock(t *testing.T, testAPIName string, fullTxs bool) {
// Author is called when calculates miner field of Header.
dummyMiner := common.HexToAddress("0x9712f943b296758aaae79944ec975884188d3a96")
mockEngine.EXPECT().Author(gomock.Any()).Return(dummyMiner, nil)
var dummyTotalDifficulty uint64 = 5
mockBackend.EXPECT().GetTd(gomock.Any()).Return(new(big.Int).SetUint64(dummyTotalDifficulty))

// Create dummy header
header := types.CopyHeader(&types.Header{
Expand Down Expand Up @@ -2492,6 +2488,7 @@ func testEstimateGas(t *testing.T, mockBackend *mock_api.MockBackend, fnEstimate
mockBackend.EXPECT().StateAndHeaderByNumber(any, any).DoAndReturn(getStateAndHeader).AnyTimes()
mockBackend.EXPECT().StateAndHeaderByNumberOrHash(any, any).DoAndReturn(getStateAndHeader).AnyTimes()
mockBackend.EXPECT().GetEVM(any, any, any, any, any).DoAndReturn(getEVM).AnyTimes()
mockBackend.EXPECT().IsConsoleLogEnabled().Return(false).AnyTimes()

testcases := []struct {
args EthTransactionArgs
Expand Down
17 changes: 11 additions & 6 deletions api/api_public_blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ func (s *PublicBlockChainAPI) IsSenderTxHashIndexingEnabled() bool {
return s.b.IsSenderTxHashIndexingEnabled()
}

// IsConsoleLogEnabled returns if console log is enabled or not.
func (s *PublicBlockChainAPI) IsConsoleLogEnabled() bool {
return s.b.IsConsoleLogEnabled()
}

// CallArgs represents the arguments for a call.
type CallArgs struct {
From common.Address `json:"from"`
Expand Down Expand Up @@ -327,7 +332,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
// this makes sure resources are cleaned up.
defer cancel()

intrinsicGas, err := types.IntrinsicGas(args.InputData(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
intrinsicGas, dataTokens, err := types.IntrinsicGas(args.InputData(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
if err != nil {
return nil, 0, err
}
Expand All @@ -339,7 +344,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
} else {
baseFee = new(big.Int).SetUint64(params.ZeroBaseFee)
}
msg, err := args.ToMessage(globalGasCap.Uint64(), baseFee, intrinsicGas)
msg, err := args.ToMessage(globalGasCap.Uint64(), baseFee, intrinsicGas, dataTokens)
if err != nil {
return nil, 0, err
}
Expand Down Expand Up @@ -387,7 +392,7 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr
if rpcGasCap := s.b.RPCGasCap(); rpcGasCap != nil {
gasCap = rpcGasCap
}
result, _, err := DoCall(ctx, s.b, args, blockNrOrHash, vm.Config{ComputationCostLimit: params.OpcodeComputationCostLimitInfinite}, s.b.RPCEVMTimeout(), gasCap)
result, _, err := DoCall(ctx, s.b, args, blockNrOrHash, vm.Config{ComputationCostLimit: params.OpcodeComputationCostLimitInfinite, UseConsoleLog: s.b.IsConsoleLogEnabled()}, s.b.RPCEVMTimeout(), gasCap)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -595,7 +600,7 @@ func RpcOutputBlock(b *types.Block, inclTx bool, fullTx bool, config *params.Cha
}

rules := config.Rules(b.Number())
if rules.IsEthTxType {
if rules.IsMagma {
if head.BaseFee == nil {
fields["baseFeePerGas"] = (*hexutil.Big)(new(big.Int).SetUint64(params.ZeroBaseFee))
} else {
Expand Down Expand Up @@ -689,7 +694,7 @@ func newRPCTransactionFromBlockHash(b *types.Block, hash common.Hash, config *pa
return nil
}

func (args *CallArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64) (*types.Transaction, error) {
func (args *CallArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64, dataTokens uint64) (*types.Transaction, error) {
if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) {
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
} else if args.MaxFeePerGas != nil && args.MaxPriorityFeePerGas != nil {
Expand Down Expand Up @@ -737,5 +742,5 @@ func (args *CallArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsic
if args.AccessList != nil {
accessList = *args.AccessList
}
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, args.InputData(), false, intrinsicGas, accessList, nil), nil
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, args.InputData(), false, intrinsicGas, dataTokens, accessList, nil), nil
}
1 change: 1 addition & 0 deletions api/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type Backend interface {
IsParallelDBWrite() bool

IsSenderTxHashIndexingEnabled() bool
IsConsoleLogEnabled() bool

// TxPool API
SendTx(ctx context.Context, signedTx *types.Transaction) error
Expand Down
28 changes: 14 additions & 14 deletions api/mocks/backend_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/tx_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ func (args *EthTransactionArgs) setDefaults(ctx context.Context, b Backend) erro
}

// ToMessage change EthTransactionArgs to types.Transaction in Kaia.
func (args *EthTransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64) (*types.Transaction, error) {
func (args *EthTransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64, dataTokens uint64) (*types.Transaction, error) {
// Reject invalid combinations of pre- and post-1559 fee styles
if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) {
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
Expand Down Expand Up @@ -780,7 +780,7 @@ func (args *EthTransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int,
if args.AccessList != nil {
accessList = *args.AccessList
}
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, data, false, intrinsicGas, accessList, nil), nil
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, data, false, intrinsicGas, dataTokens, accessList, nil), nil
}

// toTransaction converts the arguments to a transaction.
Expand Down
2 changes: 1 addition & 1 deletion blockchain/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
return func(i int, gen *BlockGen) {
toaddr := common.Address{}
data := make([]byte, nbytes)
gas, _ := types.IntrinsicGas(data, nil, nil, false, params.TestChainConfig.Rules(big.NewInt(0)))
gas, _, _ := types.IntrinsicGas(data, nil, nil, false, params.TestChainConfig.Rules(big.NewInt(0)))
signer := types.LatestSignerForChainID(params.TestChainConfig.ChainID)
tx, _ := types.SignTx(types.NewTransaction(gen.TxNonce(benchRootAddr), toaddr, big.NewInt(1), gas, nil, data), signer, benchRootKey)
gen.AddTx(tx)
Expand Down
12 changes: 0 additions & 12 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2150,18 +2150,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks) (int, []interface{}, []*ty
return i, events, coalescedLogs, err
}
}

// update governance CurrentSet if it is at an epoch block
if bc.engine.CreateSnapshot(bc, block.NumberU64(), block.Hash(), nil) != nil {
return i, events, coalescedLogs, err
}

// update governance parameters
if istanbul, ok := bc.engine.(consensus.Istanbul); ok {
if err = istanbul.UpdateParam(block.NumberU64()); err != nil {
return i, events, coalescedLogs, err
}
}
}
// Append a single chain head event if we've progressed the chain
if lastCanon != nil && bc.CurrentBlock().Hash() == lastCanon.Hash() {
Expand Down
Loading

0 comments on commit 8103dc4

Please sign in to comment.