Skip to content

Commit

Permalink
Merge branch 'develop' into set-versioning-build-flags-goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Mar 11, 2024
2 parents d157d15 + 692c06d commit 0f55721
Show file tree
Hide file tree
Showing 57 changed files with 1,261 additions and 969 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/benchmark-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Benchmark Tests
on: # yamllint disable-line rule:truthy
workflow_call:
outputs:
workflow_output:
description: "Benchmark Tests output"
value: ${{ jobs.benchmark_test.outputs.test_output_failure }}

jobs:
benchmark_test:
name: Run Benchmark Tests
runs-on: ubuntu-latest
outputs:
test_output_failure: ${{ steps.run_tests_failure.outputs.test_output }}
steps:
- name: Checkout Code
uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup Go
uses: actions/[email protected]
with:
go-version: 1.20.x
- name: Run Go Test
run: make benchmark-test
- name: Run Go Test Failed
if: failure()
id: run_tests_failure
run: echo "test_output=false" >> $GITHUB_OUTPUT

19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ on: # yamllint disable-line rule:truthy
description: Fuzz Tests
type: boolean
default: true
benchmark-test:
description: Benchmark Tests
type: boolean
default: true
workflow_call:
inputs:
build-blade:
Expand Down Expand Up @@ -65,6 +69,10 @@ on: # yamllint disable-line rule:truthy
description: Fuzz Tests
type: boolean
required: true
benchmark-test:
description: Benchmark Tests
type: boolean
default: true
outputs:
build-blade:
description: Build Blade output
Expand All @@ -87,6 +95,9 @@ on: # yamllint disable-line rule:truthy
fuzz-test:
description: Fuzz Tests output
value: ${{ jobs.fuzz-test.outputs.workflow_output }}
benchmark-test:
description: Benchmark Tests output
value: ${{ jobs.benchmark-test.outputs.workflow_output }}

jobs:
build-blade:
Expand Down Expand Up @@ -144,3 +155,11 @@ jobs:
inputs.fuzz-test ||
github.event_name == 'pull_request' ||
(github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'))
benchmark-test:
name: Benchmark Tests
uses: ./.github/workflows/benchmark-test.yml
needs: build-blade
if: |
inputs.benchmark-test ||
github.event_name == 'pull_request' ||
(github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'))
6 changes: 4 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
e2e-legacy-test: true
property-polybft-test: true
fuzz-test: true
benchmark-test: true
deploy_network:
name: Deploy Network
uses: ./.github/workflows/deploy-network.yml
Expand All @@ -53,7 +54,7 @@ jobs:
with:
environment: nightly
scenario: EOA
timeout: "220s"
timeout: "1800s"
rate: "3000"
timeUnit: "1s"
duration: "10m"
Expand All @@ -76,7 +77,7 @@ jobs:
with:
environment: nightly
scenario: ERC20
timeout: "220s"
timeout: "1800s"
rate: "1500"
timeUnit: "1s"
duration: "10m"
Expand Down Expand Up @@ -120,6 +121,7 @@ jobs:
e2e_legacy_test_output: ${{ needs.ci.outputs.e2e-legacy-test }}
property_polybft_test_output: ${{ needs.ci.outputs.property-polybft-test }}
fuzz_test_output: ${{ needs.ci.outputs.fuzz-test }}
benchmark_test_output: ${{ needs.ci.outputs.benchmark-test }}
deploy_network_terraform_output: ${{ needs.deploy_network.outputs.terraform_output }}
deploy_network_ansible_output: ${{ needs.deploy_network.outputs.ansible_output }}
load_test_multiple_eoa_output: ${{ needs.load_test_multiple_eoa.outputs.load_test_output }}
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/notification-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ on: # yamllint disable-line rule:truthy
description: Fuzz Tests output
type: string
required: true
benchmark_test_output:
description: Benchmark Tests output
type: string
required: true
deploy_network_terraform_output:
description: Deploy Network - Terraform output
type: string
Expand Down Expand Up @@ -91,7 +95,7 @@ jobs:
{
"attachments": [
{
"color": "${{ inputs.build_blade_output == '' && inputs.lint_output == '' && inputs.unit_test_output == '' && inputs.e2e_polybft_test_output == '' && inputs.e2e_legacy_test_output == '' && inputs.property_polybft_test_output == '' && inputs.fuzz_test_output == '' && inputs.deploy_network_terraform_output == '' && inputs.deploy_network_ansible_output == '' && inputs.load_test_multiple_eoa_output == 'true' && inputs.load_test_multiple_erc20_output == 'true' && inputs.destroy_network_logs_output == '' && inputs.destroy_network_terraform_output == '' && env.green_color || env.red_color }}",
"color": "${{ inputs.build_blade_output == '' && inputs.lint_output == '' && inputs.unit_test_output == '' && inputs.e2e_polybft_test_output == '' && inputs.e2e_legacy_test_output == '' && inputs.property_polybft_test_output == '' && inputs.fuzz_test_output == '' && inputs.benchmark_test_output == '' && inputs.deploy_network_terraform_output == '' && inputs.deploy_network_ansible_output == '' && inputs.load_test_multiple_eoa_output == 'true' && inputs.load_test_multiple_erc20_output == 'true' && inputs.destroy_network_logs_output == '' && inputs.destroy_network_terraform_output == '' && env.green_color || env.red_color }}",
"blocks": [
{
"type": "header",
Expand Down Expand Up @@ -152,13 +156,13 @@ jobs:
]
},
{
"color": "${{ inputs.build_blade_output == '' && inputs.lint_output == '' && inputs.unit_test_output == '' && inputs.fuzz_test_output == '' && inputs.e2e_legacy_test_output == '' && inputs.e2e_polybft_test_output == '' && inputs.property_polybft_test_output == '' && env.green_color || env.red_color }}",
"color": "${{ inputs.build_blade_output == '' && inputs.lint_output == '' && inputs.unit_test_output == '' && inputs.fuzz_test_output == '' && inputs.benchmark_test_output == '' && inputs.e2e_legacy_test_output == '' && inputs.e2e_polybft_test_output == '' && inputs.property_polybft_test_output == '' && env.green_color || env.red_color }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*CI*\n${{ inputs.build_blade_output == '' && 'Build Blade' || '~Build Blade~' }}, ${{ inputs.lint_output == '' && 'Lint' || '~Lint~' }}, ${{ inputs.unit_test_output == '' && 'Unit Tests' || '~Unit Tests~' }},\n${{ inputs.fuzz_test_output == '' && 'Fuzz Tests' || '~Fuzz Tests~' }}, ${{ inputs.e2e_legacy_test_output == '' && 'E2E Legacy Tests' || '~E2E Legacy Tests~' }},\n${{ inputs.e2e_polybft_test_output == '' && 'E2E PolyBFT Tests' || '~E2E PolyBFT Tests~' }}, ${{ inputs.property_polybft_test_output == '' && 'Property PolyBFT Tests' || '~Property PolyBFT Tests~' }}"
"text": "*CI*\n${{ inputs.build_blade_output == '' && 'Build' || '~Build~' }}, ${{ inputs.lint_output == '' && 'Lint' || '~Lint~' }}, ${{ inputs.unit_test_output == '' && 'Unit Tests' || '~Unit Tests~' }},\n${{ inputs.fuzz_test_output == '' && 'Fuzz Tests' || '~Fuzz Tests~' }}, ${{ inputs.e2e_legacy_test_output == '' && 'E2E Legacy Tests' || '~E2E Legacy Tests~' }},\n${{ inputs.e2e_polybft_test_output == '' && 'E2E PolyBFT Tests' || '~E2E PolyBFT Tests~' }}, ${{ inputs.property_polybft_test_output == '' && 'Property PolyBFT Tests' || '~Property PolyBFT Tests~' }},\n${{ inputs.benchmark_test_output == '' && 'Benchmark Tests' || '~Benchmark Tests~' }}"
}
}
]
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
[submodule "blade-contracts"]
path = blade-contracts
url = https://github.com/Ethernal-Tech/blade-contracts
[submodule "tests/evm-benchmarks"]
path = tests/evm-benchmarks
url = https://github.com/ipsilon/evm-benchmarks
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ generate-bsd-licenses: check-git
unit-test: check-go
go test -race -shuffle=on -coverprofile coverage.out -timeout 20m `go list ./... | grep -v e2e`

.PHONY: benchmark-test
benchmark-test: check-go
go test -bench=. -run=^$ `go list ./... | grep -v /e2e`

.PHONY: fuzz-test
fuzz-test: check-go
./scripts/fuzzAll
Expand Down
54 changes: 32 additions & 22 deletions blockchain/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,11 @@ func TestBlockchainWriteBody(t *testing.T) {
t.Parallel()

tx := types.NewTx(&types.LegacyTx{
Value: big.NewInt(10),
V: big.NewInt(1),
From: addr,
BaseTx: &types.BaseTx{
Value: big.NewInt(10),
V: big.NewInt(1),
From: addr,
},
})

block := &types.Block{
Expand Down Expand Up @@ -623,8 +625,10 @@ func TestBlockchainWriteBody(t *testing.T) {
t.Parallel()

tx := types.NewTx(&types.LegacyTx{
Value: big.NewInt(10),
V: big.NewInt(1),
BaseTx: &types.BaseTx{
Value: big.NewInt(10),
V: big.NewInt(1),
},
})

block := &types.Block{
Expand Down Expand Up @@ -655,8 +659,10 @@ func TestBlockchainWriteBody(t *testing.T) {
t.Parallel()

tx := types.NewTx(&types.LegacyTx{
Value: big.NewInt(10),
V: big.NewInt(1),
BaseTx: &types.BaseTx{
Value: big.NewInt(10),
V: big.NewInt(1),
},
})

block := &types.Block{
Expand Down Expand Up @@ -715,8 +721,8 @@ func Test_recoverFromFieldsInBlock(t *testing.T) {
},
}

tx1 := types.NewTx(&types.LegacyTx{Nonce: 0, From: addr1})
tx2 := types.NewTx(&types.LegacyTx{Nonce: 1, From: types.ZeroAddress})
tx1 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 0, From: addr1}})
tx2 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 1, From: types.ZeroAddress}})

computeTxHashes(tx1, tx2)

Expand Down Expand Up @@ -745,9 +751,9 @@ func Test_recoverFromFieldsInBlock(t *testing.T) {
},
}

tx1 := types.NewTx(&types.LegacyTx{Nonce: 0, From: types.ZeroAddress})
tx2 := types.NewTx(&types.LegacyTx{Nonce: 1, From: types.ZeroAddress})
tx3 := types.NewTx(&types.LegacyTx{Nonce: 2, From: types.ZeroAddress})
tx1 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 0, From: types.ZeroAddress}})
tx2 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 1, From: types.ZeroAddress}})
tx3 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 2, From: types.ZeroAddress}})

computeTxHashes(tx1, tx2, tx3)

Expand Down Expand Up @@ -801,8 +807,8 @@ func Test_recoverFromFieldsInTransactions(t *testing.T) {
},
}

tx1 := types.NewTx(&types.LegacyTx{Nonce: 0, From: addr1})
tx2 := types.NewTx(&types.LegacyTx{Nonce: 1, From: types.ZeroAddress})
tx1 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 0, From: addr1}})
tx2 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 1, From: types.ZeroAddress}})

computeTxHashes(tx1, tx2)

Expand Down Expand Up @@ -830,9 +836,9 @@ func Test_recoverFromFieldsInTransactions(t *testing.T) {
},
}

tx1 := types.NewTx(&types.LegacyTx{Nonce: 0, From: types.ZeroAddress})
tx2 := types.NewTx(&types.LegacyTx{Nonce: 1, From: types.ZeroAddress})
tx3 := types.NewTx(&types.LegacyTx{Nonce: 2, From: types.ZeroAddress})
tx1 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 0, From: types.ZeroAddress}})
tx2 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 1, From: types.ZeroAddress}})
tx3 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 2, From: types.ZeroAddress}})

computeTxHashes(tx1, tx2, tx3)

Expand Down Expand Up @@ -864,8 +870,8 @@ func Test_recoverFromFieldsInTransactions(t *testing.T) {
},
}

tx1 := types.NewTx(&types.LegacyTx{Nonce: 0, From: addr1})
tx2 := types.NewTx(&types.LegacyTx{Nonce: 1, From: addr2})
tx1 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 0, From: addr1}})
tx2 := types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{Nonce: 1, From: addr2}})

computeTxHashes(tx1, tx2)

Expand Down Expand Up @@ -901,8 +907,10 @@ func TestBlockchainReadBody(t *testing.T) {
batchWriter := storage.NewBatchWriter(b.db)

tx := types.NewTx(&types.LegacyTx{
Value: big.NewInt(10),
V: big.NewInt(1),
BaseTx: &types.BaseTx{
Value: big.NewInt(10),
V: big.NewInt(1),
},
})

tx.ComputeHash()
Expand Down Expand Up @@ -1603,7 +1611,9 @@ func TestBlockchain_WriteFullBlock(t *testing.T) {
{GasUsed: 200},
}
tx := types.NewTx(&types.LegacyTx{
Value: big.NewInt(1),
BaseTx: &types.BaseTx{
Value: big.NewInt(1),
},
})

tx.ComputeHash()
Expand Down
10 changes: 6 additions & 4 deletions blockchain/storage/leveldb/leveldb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ func generateTxs(t *testing.T, startNonce, count int, from types.Address, to *ty

for i := range txs {
tx := types.NewTx(&types.DynamicFeeTx{
Gas: types.StateTransactionGasLimit,
Nonce: uint64(startNonce + i),
To: to,
Value: big.NewInt(2000),
GasFeeCap: big.NewInt(100),
GasTipCap: big.NewInt(10),
BaseTx: &types.BaseTx{
Gas: types.StateTransactionGasLimit,
Nonce: uint64(startNonce + i),
To: to,
Value: big.NewInt(2000),
},
})

input := make([]byte, 1000)
Expand Down
36 changes: 21 additions & 15 deletions blockchain/storage/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,25 +271,29 @@ func testBody(t *testing.T, m PlaceholderStorage) {

addr1 := types.StringToAddress("11")
t0 := types.NewTx(&types.LegacyTx{
Nonce: 0,
To: &addr1,
Value: big.NewInt(1),
Gas: 11,
GasPrice: big.NewInt(11),
Input: []byte{1, 2},
V: big.NewInt(1),
BaseTx: &types.BaseTx{
Nonce: 0,
To: &addr1,
Value: big.NewInt(1),
Gas: 11,
Input: []byte{1, 2},
V: big.NewInt(1),
},
})
t0.ComputeHash()

addr2 := types.StringToAddress("22")
t1 := types.NewTx(&types.LegacyTx{
Nonce: 0,
To: &addr2,
Value: big.NewInt(1),
Gas: 22,
GasPrice: big.NewInt(11),
Input: []byte{4, 5},
V: big.NewInt(2),
BaseTx: &types.BaseTx{
Nonce: 0,
To: &addr2,
Value: big.NewInt(1),
Gas: 22,
Input: []byte{4, 5},
V: big.NewInt(2),
},
})
t1.ComputeHash()

Expand Down Expand Up @@ -339,10 +343,12 @@ func testReceipts(t *testing.T, m PlaceholderStorage) {
body := &types.Body{
Transactions: []*types.Transaction{
types.NewTx(&types.StateTx{
Nonce: 1000,
Gas: 50,
GasPrice: new(big.Int).SetUint64(100),
V: big.NewInt(11),
BaseTx: &types.BaseTx{
Nonce: 1000,
Gas: 50,
V: big.NewInt(11),
},
}),
},
}
Expand Down
10 changes: 6 additions & 4 deletions consensus/polybft/block_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ func TestBlockBuilder_BuildBlockTxOneFailedTxAndOneTakesTooMuchGas(t *testing.T)
}

tx := types.NewTx(&types.LegacyTx{
Value: big.NewInt(amount),
GasPrice: big.NewInt(gasPrice),
Gas: gas,
Nonce: 0,
To: &acc.address,
BaseTx: &types.BaseTx{
Value: big.NewInt(amount),
Gas: gas,
Nonce: 0,
To: &acc.address,
},
})

tx, err = signer.SignTx(tx, acc.privKey)
Expand Down
Loading

0 comments on commit 0f55721

Please sign in to comment.