Skip to content

Commit e30bab3

Browse files
committed
Merge remote-tracking branch 'origin/main' into kayan_last_block_number
2 parents c867dca + f45b0c0 commit e30bab3

File tree

11 files changed

+520
-7
lines changed

11 files changed

+520
-7
lines changed

.github/workflows/node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ jobs:
275275
uses: AntelopeIO/asset-artifact-download-action@v3
276276
with:
277277
owner: eosnetworkfoundation
278-
repo: eos-evm
278+
repo: eos-evm-contract
279279
target: '${{needs.versions.outputs.eos-evm-contract-target}}'
280280
prereleases: ${{fromJSON(needs.versions.outputs.eos-evm-contract-prerelease)}}
281281
file: 'contract.tar.gz'

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ project(eos-evm-node)
2020

2121
set(VERSION_MAJOR 0)
2222
set(VERSION_MINOR 6)
23-
set(VERSION_PATCH 1)
23+
set(VERSION_PATCH 3)
2424
#set(VERSION_SUFFIX stable)
2525

2626
if(VERSION_SUFFIX)

peripherals/proxy/nginx.conf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,22 @@ http {
4444
~^5 1;
4545
}
4646

47+
limit_req_zone $http_x_forwarded_for zone=rate_limit_zone:10m rate=5r/s;
48+
limit_conn_zone $http_x_forwarded_for zone=conn_limit_zone:10m;
49+
4750
server {
4851
listen 80;
4952
server_name localhost;
5053

51-
location / {
54+
location / {
55+
limit_req zone=rate_limit_zone burst=25 nodelay;
56+
limit_req_dry_run on;
5257
try_files /nonexistent @$http_upgrade;
5358
}
5459

55-
location @websocket {
60+
location @websocket {
61+
limit_conn conn_limit_zone 2;
62+
limit_conn_dry_run on;
5663
# websocket related stuff
5764
if ($request_method = 'OPTIONS') {
5865
add_header 'Access-Control-Allow-Origin' '*';

tests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ configure_file(nodeos_eos_evm_ws_test_basic.py . COPYONLY)
55
configure_file(nodeos_eos_evm_ws_test_fork.py . COPYONLY)
66
configure_file(nodeos_eos_evm_server.py . COPYONLY)
77
configure_file(nodeos_eos_evm_test.py . COPYONLY)
8+
configure_file(defertest.wasm . COPYONLY)
9+
configure_file(defertest.abi . COPYONLY)
10+
configure_file(defertest2.wasm . COPYONLY)
11+
configure_file(defertest2.abi . COPYONLY)

tests/defertest.abi

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
3+
"version": "eosio::abi/1.2",
4+
"types": [],
5+
"structs": [
6+
{
7+
"name": "pending",
8+
"base": "",
9+
"fields": [
10+
{
11+
"name": "id",
12+
"type": "uint64"
13+
},
14+
{
15+
"name": "account",
16+
"type": "name"
17+
},
18+
{
19+
"name": "miner",
20+
"type": "name"
21+
},
22+
{
23+
"name": "rlptx",
24+
"type": "bytes"
25+
}
26+
]
27+
},
28+
{
29+
"name": "pushdefer",
30+
"base": "",
31+
"fields": [
32+
{
33+
"name": "id",
34+
"type": "uint64"
35+
},
36+
{
37+
"name": "account",
38+
"type": "name"
39+
},
40+
{
41+
"name": "miner",
42+
"type": "name"
43+
},
44+
{
45+
"name": "rlptx",
46+
"type": "bytes"
47+
},
48+
{
49+
"name": "rlptx2",
50+
"type": "bytes"
51+
}
52+
]
53+
},
54+
{
55+
"name": "pushtxinline",
56+
"base": "",
57+
"fields": [
58+
{
59+
"name": "account",
60+
"type": "name"
61+
},
62+
{
63+
"name": "miner",
64+
"type": "name"
65+
},
66+
{
67+
"name": "rlptx",
68+
"type": "bytes"
69+
}
70+
]
71+
}
72+
],
73+
"actions": [
74+
{
75+
"name": "pushdefer",
76+
"type": "pushdefer",
77+
"ricardian_contract": ""
78+
},
79+
{
80+
"name": "pushtxinline",
81+
"type": "pushtxinline",
82+
"ricardian_contract": ""
83+
}
84+
],
85+
"tables": [
86+
{
87+
"name": "pending",
88+
"type": "pending",
89+
"index_type": "i64",
90+
"key_names": [],
91+
"key_types": []
92+
}
93+
],
94+
"ricardian_clauses": [],
95+
"variants": [],
96+
"action_results": []
97+
}

tests/defertest.cpp

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <math.h>
4+
#include <type_traits>
5+
#include <tuple>
6+
#include <eosio/eosio.hpp>
7+
#include <eosio/asset.hpp>
8+
#include <eosio/contract.hpp>
9+
#include <eosio/system.hpp>
10+
#include <eosio/transaction.hpp>
11+
#include <eosio/serialize.hpp>
12+
#include <eosio/print.hpp>
13+
#include <eosio/name.hpp>
14+
15+
using namespace eosio;
16+
using namespace std;
17+
18+
extern "C" {
19+
__attribute__((eosio_wasm_import))
20+
uint64_t current_time();
21+
}
22+
23+
class [[eosio::contract("defertest")]] defertest : public eosio::contract {
24+
25+
public:
26+
using contract::contract;
27+
28+
int32_t now() {
29+
return current_time() / 1000000;
30+
}
31+
32+
struct [[eosio::table]] pending {
33+
uint64_t id;
34+
eosio::name account;
35+
eosio::name miner;
36+
std::vector<char> rlptx;
37+
38+
uint64_t primary_key() const { return id; }
39+
};
40+
typedef eosio::multi_index<"pending"_n, pending> pending_table_t;
41+
42+
// notify by the contract account of contract "defertest2.cpp"
43+
[[eosio::on_notify("*::notifytest")]] void notifytest(eosio::name recipient, eosio::name account, eosio::name miner, const std::vector<char> &rlptx, const std::vector<char> &rlptx2) {
44+
action act({_self, "active"_n}, account, "pushtx"_n,
45+
std::tuple<eosio::name, std::vector<char> >(miner, rlptx2));
46+
act.send();
47+
}
48+
49+
[[eosio::action]] void pushtxinline(eosio::name account, eosio::name miner, const std::vector<char> &rlptx) {
50+
action act({_self, "active"_n}, account, "pushtx"_n,
51+
std::tuple<eosio::name, std::vector<char> >(miner, rlptx));
52+
act.send();
53+
}
54+
55+
[[eosio::action]] void pushdefer(uint64_t id, eosio::name account, eosio::name miner, const std::vector<char> &rlptx, const std::vector<char> &rlptx2) {
56+
57+
printf("enter defertest.cpp::pushdefer:%d %d", (int)rlptx.size(), (int)rlptx2.size());
58+
59+
action act(permission_level{_self, "active"_n}, account, "pushtx"_n, std::tuple<eosio::name, std::vector<char> >(miner, rlptx));
60+
transaction txn(time_point_sec(current_time() + 3590));
61+
txn.actions.push_back(act);
62+
auto serialize = pack(txn);
63+
::send_deferred((uint128_t)(id), _self, serialize.data(), serialize.size(), true);
64+
65+
if (rlptx2.size()) {
66+
pending_table_t pending_table(_self, _self.value);
67+
pending_table.emplace(_self, [&](auto &v) {
68+
v.id = id;
69+
v.account = account;
70+
v.miner = miner;
71+
v.rlptx = rlptx2;
72+
});
73+
}
74+
}
75+
76+
[[eosio::on_notify("eosio::onerror")]] void onerror() {
77+
78+
pending_table_t pending_table(_self, _self.value);
79+
if (pending_table.begin() != pending_table.end()) {
80+
81+
printf("defertest.cpp::onerror() 1");
82+
auto itr = pending_table.end();
83+
--itr;
84+
action act(permission_level{_self, "active"_n}, itr->account, "pushtx"_n,
85+
std::tuple<eosio::name, std::vector<char> >(itr->miner, itr->rlptx));
86+
act.send();
87+
pending_table.erase(itr);
88+
}
89+
else {
90+
printf("defertest.cpp::onerror() 2");
91+
check(false, "hard-fail");
92+
}
93+
}
94+
};

tests/defertest.wasm

18 KB
Binary file not shown.

tests/defertest2.abi

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
3+
"version": "eosio::abi/1.2",
4+
"types": [],
5+
"structs": [
6+
{
7+
"name": "notifytest",
8+
"base": "",
9+
"fields": [
10+
{
11+
"name": "recipient",
12+
"type": "name"
13+
},
14+
{
15+
"name": "account",
16+
"type": "name"
17+
},
18+
{
19+
"name": "miner",
20+
"type": "name"
21+
},
22+
{
23+
"name": "rlptx",
24+
"type": "bytes"
25+
},
26+
{
27+
"name": "rlptx2",
28+
"type": "bytes"
29+
}
30+
]
31+
}
32+
],
33+
"actions": [
34+
{
35+
"name": "notifytest",
36+
"type": "notifytest",
37+
"ricardian_contract": ""
38+
}
39+
],
40+
"tables": [],
41+
"ricardian_clauses": [],
42+
"variants": [],
43+
"action_results": []
44+
}

tests/defertest2.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <math.h>
4+
#include <type_traits>
5+
#include <tuple>
6+
#include <eosio/eosio.hpp>
7+
#include <eosio/contract.hpp>
8+
#include <eosio/system.hpp>
9+
#include <eosio/transaction.hpp>
10+
#include <eosio/serialize.hpp>
11+
#include <eosio/print.hpp>
12+
#include <eosio/name.hpp>
13+
14+
using namespace eosio;
15+
using namespace std;
16+
17+
class [[eosio::contract("defertest2")]] defertest2 : public eosio::contract {
18+
19+
public:
20+
using contract::contract;
21+
22+
// recipient is the contract account of contract "defertest.cpp"
23+
[[eosio::action]] void notifytest(eosio::name recipient, eosio::name account, eosio::name miner, const std::vector<char> &rlptx, const std::vector<char> &rlptx2) {
24+
25+
action act({_self, "active"_n}, recipient, "pushtxinline"_n,
26+
std::tuple<eosio::name, eosio::name, std::vector<char> >(account, miner, rlptx));
27+
act.send();
28+
29+
require_recipient(recipient);
30+
}
31+
32+
};

tests/defertest2.wasm

3.57 KB
Binary file not shown.

0 commit comments

Comments
 (0)