Skip to content

Commit

Permalink
build(deps): bump lib/kakarot from dd7f25b to 5279fd2 (kkrt-labs#899
Browse files Browse the repository at this point in the history
)

* build(deps): bump lib/kakarot from `dd7f25b` to `5279fd2`

Bumps [lib/kakarot](https://github.com/kkrt-labs/kakarot) from `dd7f25b` to `5279fd2`.
- [Release notes](https://github.com/kkrt-labs/kakarot/releases)
- [Commits](kkrt-labs/kakarot@dd7f25b...5279fd2)

---
updated-dependencies:
- dependency-name: lib/kakarot
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix docker

* take chain id modulo u64::MAX

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gregory Edison <[email protected]>
  • Loading branch information
dependabot[bot] and greged93 authored Mar 28, 2024
1 parent c71507a commit 97f8aca
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docker/hive/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ FROM mongo:6.0.8 as mongo

# Ethereum RPC Server
### Build the Cairo programs artifacts
FROM python:3.9.13 as compiler
FROM python:3.10.13 as compiler
# install poetry
ENV POETRY_VERSION=1.7.1
ENV PATH="$PATH:/root/.local/bin:/root/.foundry/bin"
Expand Down
2 changes: 1 addition & 1 deletion lib/kakarot
Submodule kakarot updated 56 files
+3 −3 .env.example
+4 −4 Makefile
+7 −7 README.md
+500 −447 blockchain-tests-skip.yml
+3 −3 docker/deployer/Dockerfile
+4 −4 docs/general/decode_a_cairo_trace.md
+2 −1 docs/general/kakarot_components.md
+0 −220 docs/supported_opcodes.md
+0 −0 kakarot_scripts/artifacts.py
+1 −1 kakarot_scripts/check_resources.py
+2 −2 kakarot_scripts/compile_kakarot.py
+2 −0 kakarot_scripts/constants.py
+3 −3 kakarot_scripts/deploy_kakarot.py
+39 −22 kakarot_scripts/ef_tests/debug.py
+26 −8 kakarot_scripts/ef_tests/fetch.py
+0 −0 kakarot_scripts/ef_tests/resources.py
+0 −0 kakarot_scripts/utils/erc20.json
+7 −7 kakarot_scripts/utils/kakarot.py
+4 −2 kakarot_scripts/utils/starknet.py
+1,823 −1,678 poetry.lock
+14 −3 pyproject.toml
+34 −17 src/backend/starknet.cairo
+132 −6 src/kakarot/account.cairo
+0 −9 src/kakarot/accounts/contract/contract_account.cairo
+0 −30 src/kakarot/accounts/contract/library.cairo
+4 −2 src/kakarot/accounts/eoa/library.cairo
+23 −21 src/kakarot/constants.cairo
+7 −1 src/kakarot/errors.cairo
+1 −0 src/kakarot/gas.cairo
+13 −0 src/kakarot/instructions/block_information.cairo
+123 −1 src/kakarot/instructions/memory_operations.cairo
+18 −13 src/kakarot/instructions/system_operations.cairo
+0 −3 src/kakarot/interfaces/interfaces.cairo
+7 −6 src/kakarot/interpreter.cairo
+6 −0 src/kakarot/model.cairo
+3 −1 src/kakarot/precompiles/precompiles.cairo
+29 −0 src/kakarot/state.cairo
+25 −0 src/utils/utils.cairo
+1 −1 tests/end_to_end/PlainOpcodes/test_counter.py
+22 −10 tests/end_to_end/PlainOpcodes/test_plain_opcodes.py
+1 −1 tests/end_to_end/PlainOpcodes/test_safe.py
+1 −1 tests/end_to_end/Solmate/test_erc20.py
+1 −1 tests/end_to_end/Solmate/test_erc721.py
+1 −1 tests/end_to_end/UniswapV2/test_uniswap_v2_erc20.py
+1 −1 tests/end_to_end/UniswapV2/test_uniswap_v2_factory.py
+75 −1 tests/end_to_end/bytecodes.py
+16 −16 tests/end_to_end/conftest.py
+8 −5 tests/end_to_end/test_kakarot.py
+2 −2 tests/fixtures/starknet.py
+24 −1 tests/src/kakarot/instructions/test_block_information.py
+6 −3 tests/src/kakarot/precompiles/test_precompiles.py
+1 −1 tests/src/kakarot/test_account.py
+2 −2 tests/src/kakarot/test_kakarot.py
+3 −2 tests/src/kakarot/test_state.py
+7 −2 tests/utils/constants.py
+1 −1 tests/utils/helpers.py
9 changes: 5 additions & 4 deletions src/eth_provider/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ where
SP: starknet::providers::Provider + Send + Sync,
{
async fn block_number(&self) -> EthProviderResult<U64> {
let filter = doc! {};
let sort = doc! { "header.number": -1 };
let header: Option<StoredHeader> = self.database.get_one("headers", filter, sort).await?;
let header: Option<StoredHeader> = self.database.get_one("headers", None, sort).await?;
let block_number = match header {
None => U64::from(self.starknet_provider.block_number().await.map_err(KakarotError::from)?), // in case the database is empty, use the starknet provider
Some(header) => {
Expand Down Expand Up @@ -632,8 +631,10 @@ impl<SP> EthDataProvider<SP>
where
SP: starknet::providers::Provider + Send + Sync,
{
pub const fn new(database: Database, starknet_provider: SP, chain_id: u64) -> Self {
Self { database, starknet_provider, chain_id }
pub async fn new(database: Database, starknet_provider: SP) -> Result<Self> {
let chain_id = starknet_provider.chain_id().await?;
let chain_id = (FieldElement::from(u64::MAX) & chain_id).try_into().unwrap(); // safe unwrap
Ok(Self { database, starknet_provider, chain_id })
}

#[cfg(feature = "testing")]
Expand Down
19 changes: 11 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use kakarot_rpc::eth_rpc::rpc::KakarotRpcModuleBuilder;
use kakarot_rpc::eth_rpc::run_server;
use mongodb::options::{DatabaseOptions, ReadConcern, WriteConcern};
use starknet::providers::jsonrpc::HttpTransport;
use starknet::providers::{JsonRpcClient, Provider as _, SequencerGatewayProvider};
use starknet::providers::{JsonRpcClient, SequencerGatewayProvider};
use tracing_subscriber::util::SubscriberInitExt;

enum StarknetProvider {
Expand Down Expand Up @@ -50,16 +50,19 @@ async fn main() -> Result<()> {
DatabaseOptions::builder().read_concern(ReadConcern::MAJORITY).write_concern(WriteConcern::MAJORITY).build(),
));

let provider =
JsonRpcClient::new(HttpTransport::new(starknet_config.network.provider_url().expect("Incorrect provider URL")));
let chain_id = provider.chain_id().await?;
let chain_id: u64 = chain_id.try_into()?;

// Get the deployer nonce and set the value in the DEPLOY_WALLET_NONCE
#[cfg(feature = "hive")]
{
use kakarot_rpc::eth_provider::constant::{CHAIN_ID, DEPLOY_WALLET, DEPLOY_WALLET_NONCE};
use starknet::accounts::ConnectedAccount;
use starknet::providers::Provider as _;
use starknet_crypto::FieldElement;

let provider = JsonRpcClient::new(HttpTransport::new(
starknet_config.network.provider_url().expect("Incorrect provider URL"),
));
let chain_id = provider.chain_id().await?;
let chain_id: u64 = (FieldElement::from(u64::MAX) & chain_id).try_into()?;

CHAIN_ID.set(chain_id.into()).expect("Failed to set chain id");

Expand All @@ -71,12 +74,12 @@ async fn main() -> Result<()> {
let kakarot_rpc_module = match starknet_provider {
StarknetProvider::JsonRpcClient(starknet_provider) => {
let starknet_provider = Arc::new(starknet_provider);
let eth_provider = EthDataProvider::new(db, starknet_provider, chain_id);
let eth_provider = EthDataProvider::new(db, starknet_provider).await?;
KakarotRpcModuleBuilder::new(eth_provider).rpc_module()
}
StarknetProvider::SequencerGatewayProvider(starknet_provider) => {
let starknet_provider = Arc::new(starknet_provider);
let eth_provider = EthDataProvider::new(db, starknet_provider, chain_id);
let eth_provider = EthDataProvider::new(db, starknet_provider).await?;
KakarotRpcModuleBuilder::new(eth_provider).rpc_module()
}
}?;
Expand Down
8 changes: 4 additions & 4 deletions src/test_utils/katana/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use katana_primitives::genesis::json::GenesisJson;
use katana_primitives::genesis::Genesis;
use reth_primitives::B256;
use starknet::providers::jsonrpc::HttpTransport;
use starknet::providers::{JsonRpcClient, Provider};
use starknet::providers::JsonRpcClient;

use crate::eth_provider::provider::EthDataProvider;
use crate::test_utils::eoa::KakarotEOA;
Expand Down Expand Up @@ -68,9 +68,9 @@ impl Katana {

// Create a Kakarot client
let database = mock_database().await;
let chain_id = starknet_provider.chain_id().await.unwrap_or_default();
let chain_id: u64 = chain_id.try_into().unwrap_or_default();
let eth_provider = Arc::new(EthDataProvider::new(database, starknet_provider, chain_id));
let eth_provider = Arc::new(
EthDataProvider::new(database, starknet_provider).await.expect("Failed to create EthDataProvider"),
);

let eoa = KakarotEOA::new(pk, eth_provider);

Expand Down

0 comments on commit 97f8aca

Please sign in to comment.