Skip to content

Commit bb9bb5f

Browse files
authored
Merge branch 'ripple/smart-escrow' into develop2
2 parents b4b53a6 + c533abd commit bb9bb5f

File tree

21 files changed

+2436
-811
lines changed

21 files changed

+2436
-811
lines changed

.github/actions/dependencies/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ runs:
1717
conan export external/rocksdb rocksdb/9.7.3@
1818
conan export external/soci soci/4.0.3@
1919
conan export external/nudb nudb/2.0.8@
20+
conan export -k external/wamr wamr/2.2.0@
2021
- name: add Ripple Conan remote
2122
shell: bash
2223
run: |

.github/workflows/nix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ jobs:
408408
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
409409
conan export external/snappy snappy/1.1.10@
410410
conan export external/soci soci/4.0.3@
411+
conan export -k external/wamr wamr/2.2.0@
411412
412413
- name: build dependencies
413414
run: |

BUILD.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ It fixes some source files to add missing `#include`s.
204204
conan export --version 2.0.8 external/nudb
205205
```
206206

207+
Export our [Conan recipe for WAMR](./external/wamr).
208+
It add metering and expose some internal structures.
209+
210+
211+
```
212+
# Conan 1.x
213+
conan export external/wamr wamr/2.2.0@
214+
# Conan 2.x
215+
conan export --version 2.2.0 external/wamr
216+
```
217+
207218
### Build and Test
208219

209220
1. Create a build directory and move into it.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ endif()
115115
find_package(nudb REQUIRED)
116116
find_package(date REQUIRED)
117117
find_package(xxHash REQUIRED)
118-
find_package(wasmedge REQUIRED)
118+
find_package(wamr REQUIRED)
119119

120120
target_link_libraries(ripple_libs INTERFACE
121121
ed25519::ed25519

cfg/rippled-example.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@
12591259
# default. Don't change this without understanding the consequences.
12601260
#
12611261
# Example:
1262-
# extension_compute_limit = 2000000 # 2 million gas
1262+
# extension_compute_limit = 1000000 # 1 million gas
12631263
#
12641264
# extension_size_limit = <bytes>
12651265
#
@@ -1271,7 +1271,7 @@
12711271
# default. Don't change this without understanding the consequences.
12721272
#
12731273
# Example:
1274-
# extension_size_limit = 2000000 # 2 mb
1274+
# extension_size_limit = 100000 # 100 kb
12751275
#
12761276
# gas_price = <bytes>
12771277
#
@@ -1281,7 +1281,7 @@
12811281
# default. Don't change this without understanding the consequences.
12821282
#
12831283
# Example:
1284-
# gas_price = 2000000 # 2 drops per gas
1284+
# gas_price = 1000000 # 1 drop per gas
12851285
#-------------------------------------------------------------------------------
12861286
#
12871287
# 9. Misc Settings

cmake/RippledCore.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ target_link_libraries(xrpl.imports.main
6565
xrpl.libpb
6666
xxHash::xxhash
6767
$<$<BOOL:${voidstar}>:antithesis-sdk-cpp>
68-
wasmedge::wasmedge
68+
wamr::wamr
6969
)
7070

7171
include(add_module)

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Xrpl(ConanFile):
3333
'soci/4.0.3',
3434
'xxhash/0.8.2',
3535
'zlib/1.3.1',
36-
'wasmedge/0.14.1',
36+
'wamr/2.2.0',
3737
]
3838

3939
tool_requires = [

external/wamr/conandata.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
patches:
2+
2.2.0:
3+
- patch_description: add metering to iwasm interpreter
4+
patch_file: patches/ripp_metering.patch
5+
patch_type: conan
6+

external/wamr/conanfile.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
from conans import ConanFile, tools
2+
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
3+
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy
4+
import os
5+
import json
6+
7+
required_conan_version = ">=1.55.0"
8+
9+
class WamrConan(ConanFile):
10+
name = "wamr"
11+
version = "2.2.0"
12+
license = "Apache License v2.0"
13+
url = "https://github.com/bytecodealliance/wasm-micro-runtime.git"
14+
description = "Webassembly micro runtime"
15+
package_type = "library"
16+
settings = "os", "compiler", "build_type", "arch"
17+
options = {"shared": [True, False], "fPIC": [True, False]}
18+
default_options = {"shared": False, "fPIC": True}
19+
generators = "CMakeToolchain", "CMakeDeps"
20+
#requires = [("llvm/20.1.1@")]
21+
22+
def export_sources(self):
23+
export_conandata_patches(self)
24+
pass
25+
26+
27+
#def build_requirements(self):
28+
# self.tool_requires("llvm/20.1.1")
29+
30+
31+
def config_options(self):
32+
if self.settings.os == "Windows":
33+
del self.options.fPIC
34+
35+
36+
def layout(self):
37+
cmake_layout(self, src_folder="src")
38+
39+
40+
def source(self):
41+
git = tools.Git()
42+
git.clone("https://github.com/bytecodealliance/wasm-micro-runtime.git", "c883fafead005e87ad3122b05409886f507c1cb0",shallow=True)
43+
#get(self, **self.conan_data["sources"][self.version], strip_root=True)
44+
45+
46+
def generate(self):
47+
tc = CMakeToolchain(self)
48+
49+
tc.variables["WAMR_BUILD_INTERP"] = 1
50+
tc.variables["WAMR_BUILD_FAST_INTERP"] = 1
51+
tc.variables["WAMR_BUILD_INSTRUCTION_METERING"] = 1
52+
tc.variables["WAMR_BUILD_AOT"] = 0
53+
tc.variables["WAMR_BUILD_JIT"] = 0
54+
tc.variables["WAMR_BUILD_FAST_JIT"] = 0
55+
tc.variables["WAMR_DISABLE_HW_BOUND_CHECK"] = 1
56+
tc.variables["WAMR_DISABLE_STACK_HW_BOUND_CHECK"] = 1
57+
#tc.variables["WAMR_BUILD_FAST_JIT"] = 0 if self.settings.os == "Windows" else 1
58+
#ll_dep = self.dependencies["llvm"]
59+
#self.output.info(f"-----------package_folder: {type(ll_dep.__dict__)}")
60+
#tc.variables["LLVM_DIR"] = os.path.join(ll_dep.package_folder, "lib", "cmake", "llvm")
61+
tc.generate()
62+
63+
# This generates "foo-config.cmake" and "bar-config.cmake" in self.generators_folder
64+
deps = CMakeDeps(self)
65+
deps.generate()
66+
67+
68+
def build(self):
69+
apply_conandata_patches(self)
70+
cmake = CMake(self)
71+
cmake.verbose = True
72+
cmake.configure()
73+
cmake.build()
74+
#self.run(f'echo {self.source_folder}')
75+
# Explicit way:
76+
# self.run('cmake %s/hello %s' % (self.source_folder, cmake.command_line))
77+
# self.run("cmake --build . %s" % cmake.build_config)
78+
79+
80+
def package(self):
81+
cmake = CMake(self)
82+
cmake.verbose = True
83+
cmake.install()
84+
85+
86+
def package_info(self):
87+
self.cpp_info.libs = ["iwasm"]
88+
self.cpp_info.names["cmake_find_package"] = "wamr"
89+
self.cpp_info.names["cmake_find_package_multi"] = "wamr"
90+

0 commit comments

Comments
 (0)