Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Return Lost Changes to Node.py Functions #874

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
866dfae
Minor pinned build script README changes
kj4ezj Mar 21, 2023
df36855
Pull note about sudo into its own quote block
kj4ezj Mar 21, 2023
7f27916
Cardinal objects should be in a numbered list
kj4ezj Mar 17, 2023
8fc769e
Restore markdown formatting erroneously deleted in commit 06c9e253277…
kj4ezj Mar 17, 2023
f3aab2c
Merge pull request #849 from AntelopeIO/zach-readme
kj4ezj Mar 21, 2023
1e3f12d
Merge remote-tracking branch 'origin/release/4.0' into merge_4_0_0_rc_1
linh2931 Mar 21, 2023
3beffd5
correct version after merging from 4.0.0-rc1
linh2931 Mar 21, 2023
c7d0f6c
Merge pull request #855 from AntelopeIO/merge_4_0_0_rc_1
linh2931 Mar 21, 2023
c2366d3
fix comparison of different signedness warning in log_index
spoonincode Mar 22, 2023
bef672a
Merge pull request #860 from AntelopeIO/log_index_un_signed_warn
spoonincode Mar 22, 2023
f8ca18d
add static_assert()s on required size of IR::OpcodeAndImm<>s
spoonincode Mar 22, 2023
95c22b6
add PACKED_STRUCT on ControlStructureImm to silence warning
spoonincode Mar 22, 2023
1985e28
Merge pull request #866 from AntelopeIO/ignored_pack_warn_fix
spoonincode Mar 22, 2023
6c8441b
return lost changes to Node.py functions
ClaytonCalabrese Mar 22, 2023
c9596cd
Minor pinned build script README changes
kj4ezj Mar 21, 2023
df4a974
Pull note about sudo into its own quote block
kj4ezj Mar 21, 2023
6b54dac
Cardinal objects should be in a numbered list
kj4ezj Mar 17, 2023
1f0f528
Restore markdown formatting erroneously deleted in commit 06c9e253277…
kj4ezj Mar 17, 2023
41f5a14
correct version after merging from 4.0.0-rc1
linh2931 Mar 21, 2023
a9c5cd9
fix comparison of different signedness warning in log_index
spoonincode Mar 22, 2023
f469d2b
add static_assert()s on required size of IR::OpcodeAndImm<>s
spoonincode Mar 22, 2023
7c94e3a
add PACKED_STRUCT on ControlStructureImm to silence warning
spoonincode Mar 22, 2023
09390a4
return lost changes to Node.py functions
ClaytonCalabrese Mar 22, 2023
4ccaca3
Merge branch 'fix_missing_node_py_changes' of https://github.com/Ante…
ClaytonCalabrese Mar 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ set( CMAKE_CXX_EXTENSIONS ON )
set( CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 4)
set(VERSION_MINOR 0)
set(VERSION_MINOR 1)
set(VERSION_PATCH 0)
set(VERSION_SUFFIX rc1)
set(VERSION_SUFFIX dev)

if(VERSION_SUFFIX)
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ git clone --recursive https://github.com/AntelopeIO/leap.git
git clone --recursive git@github.com:AntelopeIO/leap.git
```

> ℹ️ **HTTPS vs. SSH Clone** ℹ️
> ℹ️ **HTTPS vs. SSH Clone** ℹ️
Both an HTTPS or SSH git clone will yield the same result - a folder named `leap` containing our source code. It doesn't matter which type you use.

Navigate into that folder:
Expand All @@ -96,13 +96,13 @@ git submodule update --init --recursive
### Step 3 - Build
Select build instructions below for a [pinned build](#pinned-build) (preferred) or an [unpinned build](#unpinned-build).

> ℹ️ **Pinned vs. Unpinned Build** ℹ️
> ℹ️ **Pinned vs. Unpinned Build** ℹ️
We have two types of builds for Leap: "pinned" and "unpinned." The only difference is that pinned builds use specific versions for some dependencies hand-picked by the Leap engineers - they are "pinned" to those versions. In contrast, unpinned builds use the default dependency versions available on the build system at the time. We recommend performing a "pinned" build to ensure the compiler and boost versions remain the same between builds of different Leap versions. Leap requires these versions to remain the same, otherwise its state might need to be recovered from a portable snapshot or the chain needs to be replayed.

> ⚠️ **A Warning On Parallel Compilation Jobs (`-j` flag)** ⚠️
> ⚠️ **A Warning On Parallel Compilation Jobs (`-j` flag)** ⚠️
When building C/C++ software, often the build is performed in parallel via a command such as `make -j "$(nproc)"` which uses all available CPU threads. However, be aware that some compilation units (`*.cpp` files) in Leap will consume nearly 4GB of memory. Failures due to memory exhaustion will typically, but not always, manifest as compiler crashes. Using all available CPU threads may also prevent you from doing other things on your computer during compilation. For these reasons, consider reducing this value.

> 🐋 **Docker and `sudo`** 🐋
> 🐋 **Docker and `sudo`** 🐋
If you are in an Ubuntu docker container, omit `sudo` from all commands because you run as `root` by default. Most other docker containers also exclude `sudo`, especially Debian-family containers. If your shell prompt is a hash tag (`#`), omit `sudo`.

#### Pinned Build
Expand All @@ -111,12 +111,14 @@ Make sure you are in the root of the `leap` repo, then run the `install_depts.sh
sudo scripts/install_deps.sh
```

Next, run the pinned build script. You have to give it three arguments, in the following order:
- A temporary folder, for all dependencies that need to be built from source.
- A build folder, where the binaries you need to install will be built to.
- The number of jobs or CPU cores/threads to use (note the [jobs flag](#step-3---build) warning above).
Next, run the pinned build script. You have to give it three arguments in the following order:
1. A temporary folder, for all dependencies that need to be built from source.
1. A build folder, where the binaries you need to install will be built to.
1. The number of jobs or CPU cores/threads to use (note the [jobs flag](#step-3---build) warning above).

The following command runs the `pinned_build.sh` script, specifies a `deps` and `build` folder in the root of the Leap repo for the first two arguments, then builds the packages using all of your computer's CPU threads (Note: you don't need `sudo` for this command):
> 🔒 You do not need to run this script with `sudo` or as root.

For example, the following command runs the `pinned_build.sh` script, specifies a `deps` and `build` folder in the root of the Leap repo for the first two arguments, then builds the packages using all of your computer's CPU threads:
```bash
scripts/pinned_build.sh deps build "$(nproc)"
```
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/block_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ namespace eosio { namespace chain {
ilog("blocks.log and blocks.index agree on number of blocks");

if (interval == 0) {
interval = std::max((log_bundle.log_index.num_blocks() + 7) >> 3, 1);
interval = std::max((log_bundle.log_index.num_blocks() + 7u) >> 3, 1u);
}
uint32_t expected_block_num = log_bundle.log_data.first_block_num();

Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/eosio/chain/log_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class log_index {
bool is_open() const { return file_.is_open(); }

uint64_t back() { return nth_block_position(num_blocks()-1); }
int num_blocks() const { return num_blocks_; }
unsigned num_blocks() const { return num_blocks_; }
uint64_t nth_block_position(uint32_t n) {
file_.seek(n*sizeof(uint64_t));
uint64_t r;
Expand Down
20 changes: 18 additions & 2 deletions libraries/wasm-jit/Include/IR/Operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ namespace IR
struct NoImm {};
struct MemoryImm {};

PACKED_STRUCT(
struct ControlStructureImm
{
ResultType resultType{};
};
});

struct BranchImm
{
Expand Down Expand Up @@ -675,4 +676,19 @@ namespace IR
};

IR_API const char* getOpcodeName(Opcode opcode);
}
}

//paranoia for future platforms
static_assert(sizeof(IR::OpcodeAndImm<IR::NoImm>) == 2);
static_assert(sizeof(IR::OpcodeAndImm<IR::MemoryImm>) == 2);
static_assert(sizeof(IR::OpcodeAndImm<IR::ControlStructureImm>) == 3);
static_assert(sizeof(IR::OpcodeAndImm<IR::BranchImm>) == 6);
static_assert(sizeof(IR::OpcodeAndImm<IR::BranchTableImm>) == 18);
static_assert(sizeof(IR::OpcodeAndImm<IR::LiteralImm<I32>>) == 6);
static_assert(sizeof(IR::OpcodeAndImm<IR::LiteralImm<I64>>) == 10);
static_assert(sizeof(IR::OpcodeAndImm<IR::LiteralImm<F32>>) == 6);
static_assert(sizeof(IR::OpcodeAndImm<IR::LiteralImm<F64>>) == 10);
static_assert(sizeof(IR::OpcodeAndImm<IR::GetOrSetVariableImm<false>>) == 6);
static_assert(sizeof(IR::OpcodeAndImm<IR::CallImm>) == 6);
static_assert(sizeof(IR::OpcodeAndImm<IR::CallIndirectImm>) == 6);
static_assert(sizeof(IR::OpcodeAndImm<IR::LoadOrStoreImm<0>>) == 10);
5 changes: 4 additions & 1 deletion tests/TestHarness/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,4 +1727,7 @@ def waitForTrxGeneratorsSpinup(self, nodeId: int, numGenerators: int, timeout: i
for line in f:
firstTrxs.append(line.rstrip('\n'))
Utils.Print(f"first transactions: {firstTrxs}")
node.waitForTransactionsInBlock(firstTrxs)
status = node.waitForTransactionsInBlock(firstTrxs)
if status is None:
Utils.Print('ERROR: Failed to spin up transaction generators: never received first transactions')
return status
23 changes: 12 additions & 11 deletions tests/TestHarness/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ def getTransBlockNum(trans):
# could be a transaction response
if cntxt.hasKey("processed"):
cntxt.add("processed")
cntxt.add("action_traces")
cntxt.index(0)
if not cntxt.isSectionNull("except"):
return "no_block"
cntxt.add("action_traces")
cntxt.index(0)
return cntxt.add("block_num")

# or what the trace api plugin returns
Expand Down Expand Up @@ -242,7 +242,7 @@ def getTransaction(self, transId, silentErrors=False, exitOnError=False, delayed
assert(isinstance(transId, str))
exitOnErrorForDelayed=not delayedRetry and exitOnError
timeout=3
cmdDesc="get transaction_trace"
cmdDesc=self.fetchTransactionCommand()
cmd="%s %s" % (cmdDesc, transId)
msg="(transaction id=%s)" % (transId);
for i in range(0,(int(60/timeout) - 1)):
Expand Down Expand Up @@ -295,8 +295,8 @@ def getBlockNumByTransId(self, transId, exitOnError=True, delayedRetry=True, blo
refBlockNum=None
key=""
try:
key="[transaction][transaction_header][ref_block_num]"
refBlockNum=trans["transaction_header"]["ref_block_num"]
key = self.fetchKeyCommand()
refBlockNum = self.fetchRefBlock(trans)
refBlockNum=int(refBlockNum)+1
except (TypeError, ValueError, KeyError) as _:
Utils.Print("transaction%s not found. Transaction: %s" % (key, trans))
Expand Down Expand Up @@ -346,9 +346,9 @@ def getEosAccount(self, name, exitOnError=False, returnType=ReturnType.json):
return self.processCleosCmd(cmd, cmdDesc, silentErrors=False, exitOnError=exitOnError, exitMsg=msg, returnType=returnType)

def getTable(self, contract, scope, table, exitOnError=False):
cmdDesc = "get table --time-limit 999"
cmd="%s %s %s %s" % (cmdDesc, contract, scope, table)
msg="contract=%s, scope=%s, table=%s" % (contract, scope, table);
cmdDesc = "get table"
cmd=f"{cmdDesc} {self.cleosLimit} {contract} {scope} {table}"
msg=f"contract={contract}, scope={scope}, table={table}"
return self.processCleosCmd(cmd, cmdDesc, exitOnError=exitOnError, exitMsg=msg)

def getTableAccountBalance(self, contract, scope):
Expand Down Expand Up @@ -529,7 +529,7 @@ def getAccountCodeHash(self, account):
return m.group(1)
except subprocess.CalledProcessError as ex:
end=time.perf_counter()
msg=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
Utils.Print("ERROR: Exception during code hash retrieval. cmd Duration: %.3f sec. %s" % (end-start, msg))
return None

Expand Down Expand Up @@ -580,8 +580,9 @@ def processCleosCmd(self, cmd, cmdDesc, silentErrors=True, exitOnError=False, ex
except subprocess.CalledProcessError as ex:
if not silentErrors:
end=time.perf_counter()
msg=ex.output.decode("utf-8")
errorMsg="Exception during \"%s\". Exception message: %s. cmd Duration=%.3f sec. %s" % (cmdDesc, msg, end-start, exitMsg)
out=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
errorMsg="Exception during \"%s\". Exception message: %s. stdout: %s. cmd Duration=%.3f sec. %s" % (cmdDesc, msg, out, end-start, exitMsg)
if exitOnError:
Utils.cmdError(errorMsg)
Utils.errorExit(errorMsg)
Expand Down
13 changes: 6 additions & 7 deletions tests/TestHarness/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def transferFunds(self, source, destination, amountStr, memo="memo", force=False
self.trackCmdTransaction(trans, reportStatus=reportStatus)
except subprocess.CalledProcessError as ex:
end=time.perf_counter()
msg=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
Utils.Print("ERROR: Exception during funds transfer. cmd Duration: %.3f sec. %s" % (end-start, msg))
if exitOnError:
Utils.cmdError("could not transfer \"%s\" from %s to %s" % (amountStr, source, destination))
Expand All @@ -131,7 +131,7 @@ def transferFundsAsync(self, source, destination, amountStr, memo="memo", force=
Utils.Print("cmd Duration: %.3f sec" % (end-start))
except subprocess.CalledProcessError as ex:
end=time.perf_counter()
msg=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
Utils.Print("ERROR: Exception during spawn of funds transfer. cmd Duration: %.3f sec. %s" % (end-start, msg))
if exitOnError:
Utils.cmdError("could not transfer \"%s\" from %s to %s" % (amountStr, source, destination))
Expand All @@ -158,15 +158,15 @@ def publishContract(self, account, contractDir, wasmFile, abiFile, waitForTransB
except subprocess.CalledProcessError as ex:
if not shouldFail:
end=time.perf_counter()
msg=ex.output.decode("utf-8")
Utils.Print("ERROR: Exception during set contract. cmd Duration: %.3f sec. %s" % (end-start, msg))
out=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
Utils.Print("ERROR: Exception during set contract. stderr: %s. stdout: %s. cmd Duration: %.3f sec." % (msg, out, end-start))
return None
else:
retMap={}
retMap["returncode"]=ex.returncode
retMap["cmd"]=ex.cmd
retMap["output"]=ex.output
retMap["stdout"]=ex.stdout
retMap["stderr"]=ex.stderr
return retMap

Expand Down Expand Up @@ -213,7 +213,7 @@ def pushTransaction(self, trans, opts="", silentErrors=False, permissions=None):
Utils.Print("cmd Duration: %.3f sec" % (end-start))
return (NodeosQueries.getTransStatus(retTrans) == 'executed', retTrans)
except subprocess.CalledProcessError as ex:
msg=ex.output.decode("utf-8")
msg=ex.stderr.decode("utf-8")
if not silentErrors:
end=time.perf_counter()
Utils.Print("ERROR: Exception during push transaction. cmd Duration=%.3f sec. %s" % (end - start, msg))
Expand Down Expand Up @@ -245,7 +245,6 @@ def pushMessage(self, account, action, data, opts, silentErrors=False, signature
except subprocess.CalledProcessError as ex:
msg=ex.stderr.decode("utf-8")
output=ex.output.decode("utf-8")
msg=ex.output.decode("utf-8")
if not silentErrors:
end=time.perf_counter()
Utils.Print("ERROR: Exception during push message. stderr: %s. stdout: %s. cmd Duration=%.3f sec." % (msg, output, end - start))
Expand Down
3 changes: 2 additions & 1 deletion tests/nodeos_snapshot_diff_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def waitForBlock(node, blockNum, blockType=BlockType.head, timeout=None, reportI
acctPrivKeysList=[account1PrivKey,account2PrivKey], nodeId=snapshotNodeId, tpsPerGenerator=targetTpsPerGenerator,
numGenerators=trxGeneratorCnt, durationSec=testTrxGenDurationSec, waitToComplete=False)

cluster.waitForTrxGeneratorsSpinup(nodeId=snapshotNodeId, numGenerators=trxGeneratorCnt)
status = cluster.waitForTrxGeneratorsSpinup(nodeId=snapshotNodeId, numGenerators=trxGeneratorCnt)
assert status is not None, "ERROR: Failed to spinup Transaction Generators"

blockNum=node0.getBlockNum(BlockType.head)
timePerBlock=500
Expand Down
3 changes: 2 additions & 1 deletion tests/nodeos_startup_catchup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def waitForNodeStarted(node):
tpsPerGenerator=targetTpsPerGenerator, numGenerators=trxGeneratorCnt, durationSec=testTrxGenDurationSec,
waitToComplete=False)

cluster.waitForTrxGeneratorsSpinup(nodeId=node0.nodeId, numGenerators=trxGeneratorCnt)
status = cluster.waitForTrxGeneratorsSpinup(nodeId=node0.nodeId, numGenerators=trxGeneratorCnt)
assert status is not None, "ERROR: Failed to spinup Transaction Generators"

blockNum=head(node0)
timePerBlock=500
Expand Down