Skip to content

Commit

Permalink
fix: library linking time indeterminism (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 authored Oct 29, 2024
1 parent 11ce60e commit 90a858b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#![allow(dead_code)]

use std::collections::BTreeMap;

use lazy_static::lazy_static;

/// The default executable name.
Expand Down Expand Up @@ -75,7 +77,7 @@ lazy_static! {
.expect("Minimal proxy target machine initialization error");
let assembly_buffer = era_compiler_llvm_context::eravm_assemble(&target_machine, MINIMAL_PROXY_CONTRACT_NAME, MINIMAL_PROXY_CONTRACT_ASSEMBLY, None)
.expect("Minimal proxy assembling error");
let build = era_compiler_llvm_context::eravm_build(assembly_buffer, None, Some(MINIMAL_PROXY_CONTRACT_ASSEMBLY.to_owned()))
let build = era_compiler_llvm_context::eravm_build(assembly_buffer, &BTreeMap::new(), None, Some(MINIMAL_PROXY_CONTRACT_ASSEMBLY.to_owned()))
.expect("Minimal proxy building error");
build.bytecode
};
Expand Down
3 changes: 3 additions & 0 deletions src/project/contract/eravm_assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//! The EraVM assembly contract.
//!

use std::collections::BTreeMap;

use crate::build::contract::Contract as ContractBuild;
use crate::message_type::MessageType;
use crate::vyper::selection::Selection as VyperSelection;
Expand Down Expand Up @@ -56,6 +58,7 @@ impl Contract {

let build = era_compiler_llvm_context::eravm_build(
bytecode_buffer,
&BTreeMap::new(),
metadata_hash,
Some(self.source_code),
)?;
Expand Down
3 changes: 3 additions & 0 deletions src/project/contract/llvm_ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//! The LLVM IR contract.
//!

use std::collections::BTreeMap;

use crate::build::contract::Contract as ContractBuild;
use crate::message_type::MessageType;
use crate::vyper::selection::Selection as VyperSelection;
Expand Down Expand Up @@ -57,6 +59,7 @@ impl Contract {

let build = context.build(
contract_path,
&BTreeMap::new(),
metadata_hash,
output_selection.contains(&VyperSelection::EraVMAssembly),
false,
Expand Down
5 changes: 1 addition & 4 deletions src/project/contract/vyper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ impl Contract {
let is_minimal_proxy_used = context.vyper().is_minimal_proxy_used();
let mut build = context.build(
contract_path,
&BTreeMap::new(),
metadata_hash,
output_selection.contains(&VyperSelection::EraVMAssembly),
false,
Expand Down Expand Up @@ -377,8 +378,4 @@ impl era_compiler_llvm_context::Dependency for DependencyData {
fn resolve_path(&self, _identifier: &str) -> anyhow::Result<String> {
anyhow::bail!("Dependency mechanism is not available in Vyper");
}

fn resolve_library(&self, _path: &str) -> Option<String> {
None
}
}

0 comments on commit 90a858b

Please sign in to comment.