Skip to content

Commit afbf0a1

Browse files
antoniupoprudy-6-4
andcommitted
feat(coprocessor): add transaction dependence chains in HL (#1651)
* fix(coprocessor): host-listener, dependency chain * fix(coprocessor): fix to squash, duplicated trivial encrypt * fix(coprocessor): fix to squash, duplicated trivial encrypt, test * fix(coprocessor): fix to squash, scalars are not handles * fix(coprocessor): fix to squash, cargo fmt * feat(coprocessor): topologic timestamp * fix(coprocessor): host-listener, reject cycle and describe out of order dependencies * fix(coprocessor): do not update dependence chain timestamp on row update * fix(coprocessor): host-listener, bad condition for need to sort tx * feat(coprocessor): host-listener, dependency_count for dependency_chain * feat(coprocessor): host-listener, dependents for dependency_chain * fix(coprocessor): restrict dependence counter to block scope * fix(coprocessor): do not update dependence chain last_updated_at on release * fix(coprocessor): emit warning only when dependence chain is missing dependences * feat(coprocessor): host-listener, dependency_chain as connected component * fix(coprocessor): host-listener, update last_updated_at de chain when already processed * fix(coprocessor): deprecate schedule order in TFHE worker * chore(coprocessor): fix CI * fix(coprocessor): host-listener, params for dependency chain policy * fix(coprocessor): hist-listener, dependency_chain, cycle detection * chore(coprocessor): update charts for new params * chore(coprocessor): fix TFHE worker CI test test_extend_or_release_lock_2 --------- Co-authored-by: rudy <rudy.sicard@zama.ai>
1 parent 2785d53 commit afbf0a1

21 files changed

+1428
-185
lines changed

.github/workflows/test-suite-e2e-operators-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ jobs:
101101
username: ${{ github.actor }}
102102
password: ${{ secrets.GHCR_READ_TOKEN }}
103103

104+
- name: Login to Chainguard Registry
105+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
106+
with:
107+
registry: cgr.dev
108+
username: ${{ secrets.CGR_USERNAME }}
109+
password: ${{ secrets.CGR_PASSWORD }}
110+
104111
- name: Deploy fhevm Stack
105112
working-directory: test-suite/fhevm
106113
env:

charts/coprocessor/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,13 @@ hostListener:
153153
- --initial-block-time=12 # it can switch to real blockTime when data is available
154154
- --log-level=INFO
155155
- --health-port=8080
156-
- --dependence-cache-size=128
157156
- --reorg-maximum-duration-in-blocks=50
158157

158+
### Dependence chains parameters
159+
# - --dependence-cache-size=10000
160+
# - --dependence-by-connexity # Whether to build by connected components or linear chains only
161+
# - --dependence-cross-block # Do chains cross L1 block boundaries (default no)
162+
159163
### Catchup parameters (optional)
160164
# - --catchup-margin
161165
# - --catchup-paging

coprocessor/fhevm-engine/.sqlx/query-b97f82da02242ae2916f28242ce4b6ef6b1bad9654b4329cfe03bc1fa86ec41c.json renamed to coprocessor/fhevm-engine/.sqlx/query-101db8494f4d2b3600130016f1dd0c5d9987d64701550eeb6d3b364f3acff0dc.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/.sqlx/query-1dde98bc8c1076c5708f985512b88082da81a35fd1411d6f9871a5414075a666.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

coprocessor/fhevm-engine/.sqlx/query-aab520e6ce550c4dec799427739a68d0388c50a8b842be000d9c804fe17eba9e.json renamed to coprocessor/fhevm-engine/.sqlx/query-94e9cb426316068aa285da33e7fd1dfa34bf30db25bcf69a333a341b17b5557a.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/.sqlx/query-99f4c777cb37bcd4b28ac64e6def5355e74e6f7745a2bc22ca914dad7f2377ae.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/Cargo.lock

Lines changed: 39 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,15 @@ tfhe = { version = "=1.4.0-alpha.4", features = [
8585
] }
8686
tfhe-versionable = "=0.6.2"
8787
tfhe-zk-pok = "=0.7.4"
88+
time = "0.3.43"
8889
tokio = { version = "1.45.0", features = ["full"] }
8990
tokio-util = "0.7.15"
9091
tonic = { version = "0.12.3", features = ["server"] }
9192
tonic-build = "0.12.3"
9293
tracing = "0.1.41"
9394
tracing-subscriber = { version = "0.3.20", features = ["fmt", "json"] }
95+
tracing-test = "0.2.5"
96+
union-find = "0.4.3"
9497
humantime = "2.2.0"
9598
bytesize = "2.0.1"
9699
http = "1.3.1"

coprocessor/fhevm-engine/host-listener/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ bigdecimal = { workspace = true }
2525
clap = { workspace = true }
2626
futures-util = { workspace = true }
2727
lru = { workspace = true }
28+
prometheus = { workspace = true }
2829
rustls = { workspace = true }
2930
serde = { workspace = true }
3031
serde_json = { workspace = true }
3132
sqlx = { workspace = true }
33+
time = { workspace = true }
3234
tokio = { workspace = true }
3335
tokio-util = { workspace = true }
3436
tracing = { workspace = true }
3537
tracing-subscriber = { workspace = true }
36-
prometheus = { workspace = true }
38+
union-find = { workspace = true}
3739

3840
# local dependencies
3941
fhevm-engine-common = { path = "../fhevm-engine-common" }
@@ -43,6 +45,7 @@ alloy = { workspace = true, features = ["node-bindings"] }
4345
anyhow = { workspace = true }
4446
serial_test = { workspace = true }
4547
test-harness = { path = "../test-harness" }
48+
tracing-test = { workspace = true }
4649

4750
[build-dependencies]
4851
foundry-compilers = { workspace = true }

coprocessor/fhevm-engine/host-listener/src/cmd/mod.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,25 @@ pub struct Args {
101101

102102
#[arg(
103103
long,
104-
default_value = "128",
104+
default_value = "10000",
105105
help = "Pre-computation dependence chain cache size"
106106
)]
107107
pub dependence_cache_size: u16,
108108

109+
#[arg(
110+
long,
111+
default_value_t = false,
112+
help = "Dependence chain are connected components"
113+
)]
114+
pub dependence_by_connexity: bool,
115+
116+
#[arg(
117+
long,
118+
default_value_t = false,
119+
help = "Dependence chain are across blocks"
120+
)]
121+
pub dependence_cross_block: bool,
122+
109123
#[arg(
110124
long,
111125
default_value = "50",
@@ -842,6 +856,7 @@ impl InfiniteLogIter {
842856
warn!(
843857
new_block = ?block_logs.summary,
844858
block_time = self.block_time,
859+
nb_logs = block_logs.logs.len(),
845860
"Block timeout, proceed with last block"
846861
);
847862
break block_logs;
@@ -875,6 +890,7 @@ async fn db_insert_block(
875890
block_logs: &BlockLogs<Log>,
876891
acl_contract_address: &Option<Address>,
877892
tfhe_contract_address: &Option<Address>,
893+
args: &Args,
878894
) -> anyhow::Result<()> {
879895
info!(
880896
block = ?block_logs.summary,
@@ -890,6 +906,8 @@ async fn db_insert_block(
890906
block_logs,
891907
acl_contract_address,
892908
tfhe_contract_address,
909+
args.dependence_by_connexity,
910+
args.dependence_cross_block,
893911
)
894912
.await;
895913
let Err(err) = res else {
@@ -1052,6 +1070,7 @@ pub async fn main(args: Args) -> anyhow::Result<()> {
10521070
&block_logs,
10531071
&acl_contract_address,
10541072
&tfhe_contract_address,
1073+
&args,
10551074
)
10561075
.await;
10571076
if status.is_err() {

0 commit comments

Comments
 (0)