forked from OffchainLabs/arbitrum-classic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
patch.diff
129 lines (116 loc) · 6.32 KB
/
patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
diff --git a/packages/arb-avm-cpp/avm/include/avm/machine.hpp b/packages/arb-avm-cpp/avm/include/avm/machine.hpp
index c122e674..f96bf954 100644
--- a/packages/arb-avm-cpp/avm/include/avm/machine.hpp
+++ b/packages/arb-avm-cpp/avm/include/avm/machine.hpp
@@ -43,8 +43,10 @@ class Machine {
void initializeMachine(const MachineState& initial_state);
Assertion run(uint64_t stepCount,
- uint256_t timeBoundStart,
- uint256_t timeBoundEnd,
+ uint256_t startBlock,
+ uint256_t endBlock,
+ uint256_t startTime,
+ uint256_t endTime,
Tuple messages,
std::chrono::seconds wallLimit);
diff --git a/packages/arb-avm-cpp/avm/include/avm/machinestate/machinestate.hpp b/packages/arb-avm-cpp/avm/include/avm/machinestate/machinestate.hpp
index 2c5afdfe..0e08d566 100644
--- a/packages/arb-avm-cpp/avm/include/avm/machinestate/machinestate.hpp
+++ b/packages/arb-avm-cpp/avm/include/avm/machinestate/machinestate.hpp
@@ -27,7 +27,7 @@
enum class Status { Extensive, Halted, Error };
-typedef std::array<uint256_t, 2> TimeBounds;
+typedef std::array<uint256_t, 4> TimeBounds;
class CheckpointStorage;
diff --git a/packages/arb-avm-cpp/avm/src/machine.cpp b/packages/arb-avm-cpp/avm/src/machine.cpp
index 888d64ec..a49922f0 100644
--- a/packages/arb-avm-cpp/avm/src/machine.cpp
+++ b/packages/arb-avm-cpp/avm/src/machine.cpp
@@ -50,14 +50,16 @@ void Machine::initializeMachine(const MachineState& initial_state) {
}
Assertion Machine::run(uint64_t stepCount,
- uint256_t timeBoundStart,
- uint256_t timeBoundEnd,
+ uint256_t startBlock,
+ uint256_t endBlock,
+ uint256_t startTime,
+ uint256_t endTime,
Tuple messages,
std::chrono::seconds wallLimit) {
bool has_time_limit = wallLimit.count() != 0;
auto start_time = std::chrono::system_clock::now();
machine_state.context = AssertionContext{
- TimeBounds{{timeBoundStart, timeBoundEnd}}, std::move(messages)};
+ TimeBounds{{startBlock, endBlock, startTime, endTime}}, std::move(messages)};
while (machine_state.context.numSteps < stepCount) {
auto blockReason = runOne();
if (!nonstd::get_if<NotBlocked>(&blockReason)) {
diff --git a/packages/arb-avm-cpp/avm/src/machinestate/machineoperation.cpp b/packages/arb-avm-cpp/avm/src/machinestate/machineoperation.cpp
index c0050336..cde1f9cc 100644
--- a/packages/arb-avm-cpp/avm/src/machinestate/machineoperation.cpp
+++ b/packages/arb-avm-cpp/avm/src/machinestate/machineoperation.cpp
@@ -585,9 +585,11 @@ BlockReason send(MachineState& m) {
}
void getTime(MachineState& m) {
- Tuple tup(m.pool.get(), 2);
+ Tuple tup(m.pool.get(), 4);
tup.set_element(0, m.context.timeBounds[0]);
tup.set_element(1, m.context.timeBounds[1]);
+ tup.set_element(2, m.context.timeBounds[2]);
+ tup.set_element(3, m.context.timeBounds[3]);
m.stack.push(std::move(tup));
++m.pc;
}
diff --git a/packages/arb-avm-cpp/cavm/cmachine.cpp b/packages/arb-avm-cpp/cavm/cmachine.cpp
index 05cff6eb..8cec8192 100644
--- a/packages/arb-avm-cpp/cavm/cmachine.cpp
+++ b/packages/arb-avm-cpp/cavm/cmachine.cpp
@@ -146,22 +146,28 @@ ByteSlice machineMarshallForProof(CMachine* m) {
RawAssertion machineExecuteAssertion(CMachine* m,
uint64_t maxSteps,
- void* timeboundStartData,
- void* timeboundEndData,
+ void* startBlockData,
+ void* endBlockData,
+ void* startTimestampData,
+ void* endTimestampData,
void* inbox,
uint64_t wallLimit) {
assert(m);
Machine* mach = static_cast<Machine*>(m);
- auto timeboundStartPtr = reinterpret_cast<const char*>(timeboundStartData);
- auto timeboundStart = deserializeUint256t(timeboundStartPtr);
- auto timeboundEndPtr = reinterpret_cast<const char*>(timeboundEndData);
- auto timeboundEnd = deserializeUint256t(timeboundEndPtr);
+ auto startBlockPtr = reinterpret_cast<const char*>(startBlockData);
+ auto startBlock = deserializeUint256t(startBlockPtr);
+ auto endBlockPtr = reinterpret_cast<const char*>(endBlockData);
+ auto endBlock = deserializeUint256t(endBlockPtr);
+ auto startTimestampPtr = reinterpret_cast<const char*>(startTimestampData);
+ auto startTimestamp = deserializeUint256t(startTimestampPtr);
+ auto endTimestampPtr = reinterpret_cast<const char*>(endTimestampData);
+ auto endTimestamp = deserializeUint256t(endTimestampPtr);
auto inboxData = reinterpret_cast<const char*>(inbox);
auto messages = deserialize_value(inboxData, mach->getPool());
- Assertion assertion = mach->run(maxSteps, timeboundStart, timeboundEnd,
- nonstd::get<Tuple>(std::move(messages)),
+ Assertion assertion = mach->run(maxSteps, startBlock, endBlock, startTimestamp,
+ endTimestamp, nonstd::get<Tuple>(std::move(messages)),
std::chrono::seconds{wallLimit});
std::vector<unsigned char> outMsgData;
for (const auto& outMsg : assertion.outMessages) {
diff --git a/packages/arb-avm-cpp/cavm/cmachine.h b/packages/arb-avm-cpp/cavm/cmachine.h
index a2bdf682..987de652 100644
--- a/packages/arb-avm-cpp/cavm/cmachine.h
+++ b/packages/arb-avm-cpp/cavm/cmachine.h
@@ -69,8 +69,10 @@ CBlockReason machineIsBlocked(CMachine* m, void* currentTime, int newMessages);
RawAssertion machineExecuteAssertion(CMachine* m,
uint64_t maxSteps,
- void* timeboundStart,
- void* timeboundEnd,
+ void* startBlockData,
+ void* endBlockData,
+ void* startTimestampData,
+ void* endTimestampData,
void* inbox,
uint64_t wallLimit);