Skip to content

Commit

Permalink
Fix: Fix delegate-call bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vldm committed Jul 24, 2022
1 parent 2be7de2 commit ad8a410
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 86 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,24 @@ jobs:
image_tag: ${{ steps.build.outputs.image_tag }}
steps:
- uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to AWS ECR
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASS }}
registry: ${{ secrets.REGISTRY_HOST }}
- uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Build, tag, and push image
id: build
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: velas-solana
IMAGE_TAG: ${{ github.sha }}
REGISTRY: ${{ secrets.REGISTRY_HOST }}/velas
REPOSITORY: velas-solana
IMAGE_TAG: ${{github.sha}}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --no-cache .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=repository::$ECR_REPOSITORY"
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG --no-cache .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
echo "::set-output name=repository::$REPOSITORY"
echo "::set-output name=image_tag::$IMAGE_TAG"
8 changes: 4 additions & 4 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ exclude = [

[profile.dev]
split-debuginfo = "unpacked"


[patch."https://github.com/velas/evm"]
evm = { git = "ssh://git@github.com/velas/evm-security-fixes.git", branch = "add-traces" }

30 changes: 15 additions & 15 deletions evm-utils/evm-state/benches/bench_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::{collections::HashSet, iter, time::Instant};
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};

use evm::{ExitReason, ExitSucceed};
use evm_state::executor::FeatureSet;
use evm_state::*;
use primitive_types::{H160 as Address, H256, U256};
use sha3::{Digest, Keccak256};
use evm_state::executor::FeatureSet;

fn name_to_key<S: AsRef<str>>(name: S) -> H160 {
H256::from_slice(Keccak256::digest(name.as_ref().as_bytes()).as_slice()).into()
Expand Down Expand Up @@ -52,7 +52,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_create(contract, U256::zero(), code.clone(), u64::max_value())
},
Expand All @@ -66,7 +66,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let mut idx = 0;
b.iter(|| {
let exit_reason = black_box(executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_call(
accounts[idx % accounts.len()],
Expand Down Expand Up @@ -106,7 +106,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_create(contract, U256::zero(), code.clone(), u64::max_value())
},
Expand All @@ -132,7 +132,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = black_box(executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_call(
accounts[idx % accounts.len()],
Expand Down Expand Up @@ -163,7 +163,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_create(contract, U256::zero(), code.clone(), u64::max_value())
},
Expand Down Expand Up @@ -205,7 +205,7 @@ fn criterion_benchmark(c: &mut Criterion) {
} = black_box(executor.transaction_execute_unsinged(
caller,
tx.clone(),
|_, _, _, _| None,
|_, _, _, _, _| None,
))
.unwrap();

Expand All @@ -226,7 +226,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_create(contract, U256::zero(), code.clone(), u64::max_value())
},
Expand Down Expand Up @@ -269,7 +269,7 @@ fn criterion_benchmark(c: &mut Criterion) {
} = black_box(executor.transaction_execute_unsinged(
caller,
tx.clone(),
|_, _, _, _| None,
|_, _, _, _, _| None,
))
.unwrap();
updated_state = executor
Expand Down Expand Up @@ -301,7 +301,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_create(contract, U256::zero(), code.clone(), u64::max_value())
},
Expand Down Expand Up @@ -345,7 +345,7 @@ fn criterion_benchmark(c: &mut Criterion) {
} = black_box(executor.transaction_execute_unsinged(
caller,
tx.clone(),
|_, _, _, _| None,
|_, _, _, _, _| None,
))
.unwrap();
let state = executor.deconstruct();
Expand Down Expand Up @@ -396,7 +396,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_create(contract, U256::zero(), code.clone(), u64::max_value())
},
Expand Down Expand Up @@ -440,7 +440,7 @@ fn criterion_benchmark(c: &mut Criterion) {
} = black_box(executor.transaction_execute_unsinged(
caller,
tx.clone(),
|_, _, _, _| None,
|_, _, _, _, _| None,
))
.unwrap();
let state = executor.deconstruct();
Expand Down Expand Up @@ -473,7 +473,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let exit_reason = executor.with_executor(
|_, _, _, _| None,
|_, _, _, _, _| None,
|executor| {
executor.transact_create(contract, U256::zero(), code.clone(), u64::max_value())
},
Expand Down Expand Up @@ -514,7 +514,7 @@ fn criterion_benchmark(c: &mut Criterion) {
exit_reason,
exit_data,
..
} = black_box(executor.transaction_execute(tx.clone(), |_, _, _, _| None)).unwrap();
} = black_box(executor.transaction_execute(tx.clone(), |_, _, _, _, _| None)).unwrap();

assert!(matches!(
exit_reason,
Expand Down
Loading

0 comments on commit ad8a410

Please sign in to comment.