From 5ae1e632ea46de7a80422da31369a0c48ba4234f Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 6 Dec 2023 15:16:57 +0100 Subject: [PATCH 1/7] fix parser: remappings --- .../app/plugins/parser/services/code-parser-compiler.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts b/apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts index ecd8278ca3..1fad0fd67e 100644 --- a/apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts +++ b/apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts @@ -142,6 +142,14 @@ export default class CodeParserCompiler { this.compiler.set('runs', state.runs) this.compiler.set('useFileConfiguration', true) this.compiler.set('compilerRetriggerMode', CompilerRetriggerMode.retrigger) + + if (await this.plugin.call('fileManager', 'exists','remappings.txt')) { + const remappings = await this.plugin.call('fileManager', 'readFile','remappings.txt') + this.compiler.set('remappings', remappings.split('\n').filter(Boolean)) + } else { + this.compiler.set('remappings', []) + } + const configFileContent = { "language": "Solidity", "settings": { From b5ca83c61430cf890e5217ccfece6e587aa39d76 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 6 Dec 2023 15:27:51 +0100 Subject: [PATCH 2/7] fix settings ordering --- .../copilot/suggestion-service/copilot-suggestion.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/copilot/suggestion-service/copilot-suggestion.ts b/apps/remix-ide/src/app/plugins/copilot/suggestion-service/copilot-suggestion.ts index 4b12ba9a7c..f58b76888d 100644 --- a/apps/remix-ide/src/app/plugins/copilot/suggestion-service/copilot-suggestion.ts +++ b/apps/remix-ide/src/app/plugins/copilot/suggestion-service/copilot-suggestion.ts @@ -50,8 +50,8 @@ export class CopilotSuggestion extends Plugin { const options: SuggestOptions = { do_sample: false, top_k: 0, - temperature: max_new_tokens || 0, - max_new_tokens: temperature || 0 + temperature: temperature || 0, + max_new_tokens: max_new_tokens || 0 } return this.service.suggest(this.context ? this.context + '\n\n' + content : content, options) } @@ -76,4 +76,4 @@ export class CopilotSuggestion extends Plugin { async uninstall() { this.service.terminate() } -} \ No newline at end of file +} From d22fae26e8347d065c54058cda5b68500bc3f2c9 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 6 Dec 2023 17:45:54 +0100 Subject: [PATCH 3/7] updated UI of enter dialog --- apps/remix-ide/src/app.js | 4 ++-- apps/remix-ide/src/walkthroughService.js | 11 ++++++---- .../lib/remix-app/components/modals/enter.tsx | 22 ++++++++++--------- .../remix-app/components/modals/matomo.tsx | 8 ++++++- .../app/src/lib/remix-app/remix-app.tsx | 6 ++--- .../app/src/lib/remix-app/types/index.ts | 4 ++-- 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index e814a998c1..970837c9f3 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -130,8 +130,8 @@ class AppComponent { 'remix.ethereum.org': 23, '6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod': 35 // remix desktop } - this.showMatamo = matomoDomains[window.location.hostname] && !Registry.getInstance().get('config').api.exists('settings/matomo-analytics') - this.showEnter = this.showMatamo && !localStorage.getItem('hadUsageTypeAsked') + this.showMatamo = true /*matomoDomains[window.location.hostname]*/ && !Registry.getInstance().get('config').api.exists('settings/matomo-analytics') + this.showEnter = !this.showMatamo && !localStorage.getItem('hadUsageTypeAsked') this.walkthroughService = new WalkthroughService(appManager, !this.showMatamo || !this.showEnter) diff --git a/apps/remix-ide/src/walkthroughService.js b/apps/remix-ide/src/walkthroughService.js index f54d0e28ce..88f879d442 100644 --- a/apps/remix-ide/src/walkthroughService.js +++ b/apps/remix-ide/src/walkthroughService.js @@ -49,7 +49,7 @@ export class WalkthroughService extends Plugin { { element: document.querySelector('#udappRecorderSave'), title: 'Transactions Recorder', - intro: 'Once there is a Once one or a few transactions have been executed from Remix, click this button to save these transactions as a scenario file.', + intro: 'Once there is a one or a few transactions have been executed from Remix, click this button to save these transactions as a scenario file.', tooltipClass: 'bg-light text-dark', position: 'right', highlightClass: 'bg-light border border-warning' @@ -89,21 +89,24 @@ export class WalkthroughService extends Plugin { intro: 'Click to launch the Home tab that contains links, tips, and shortcuts..', element: document.querySelector('#verticalIconsHomeIcon'), tooltipClass: 'bg-light text-dark', - position: 'right' + position: 'right', + highlightClass: 'bg-light border border-warning' }, { element: document.querySelector('#verticalIconsKindsolidity'), title: 'Solidity Compiler', intro: 'Having selected a .sol file in the File Explorer (the icon above), compile it with the Solidity Compiler.', tooltipClass: 'bg-light text-dark', - position: 'right' + position: 'right', + highlightClass: 'bg-light border border-warning' }, { title: 'Deploy your contract', element: document.querySelector('#verticalIconsKindudapp'), intro: 'Choose a chain, deploy a contract and play with your functions.', tooltipClass: 'bg-light text-dark', - position: 'right' + position: 'right', + highlightClass: 'bg-light border border-warning' } ] }).onafterchange((targetElement) => { diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx index 30903ccc3c..540b2f228c 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx @@ -4,7 +4,7 @@ import {UsageTypes} from '../../types' import { type } from 'os' interface EnterDialogProps { - hide: boolean, + show: boolean, handleUserChoice: (userChoice: UsageTypes) => void, } @@ -13,14 +13,16 @@ const EnterDialog = (props: EnterDialogProps) => { const {showEnter} = useContext(AppContext) useEffect(() => { - setVisibility(!props.hide) - }, [props.hide]) + setVisibility(props.show) + console.log("useeff vis in enter", props.show, " showEnter ", showEnter) + }, [props.show]) const enterAs = async (uType) => { props.handleUserChoice(uType) } const modalClass = (visibility && showEnter) ? "d-flex" : "d-none" + console.log("enterDialog class ", modalClass) return (
{

Welcome to Remix IDE

-
- To load the project with the most efficient setup we would like to know your experience type. +
+ In order to understand your needs better, we would like to know how you typically use Remix
-
- - - - +
+ + + +
diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx index b1fb029b77..59391d1e09 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx @@ -8,7 +8,12 @@ declare global { } const _paq = (window._paq = window._paq || []) -const MatomoDialog = (props) => { +interface MatomoDialogProps { + okFn: () => void, + hide: boolean +} + +const MatomoDialog = (props: MatomoDialogProps) => { const {settings, showMatamo, appManager} = useContext(AppContext) const {modal} = useDialogDispatchers() const [visible, setVisible] = useState(props.hide) @@ -68,6 +73,7 @@ const MatomoDialog = (props) => { _paq.push(['setConsentGiven']); settings.updateMatomoAnalyticsChoice(true) setVisible(false) + props.okFn() } return <> diff --git a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx index 317e505d8d..a5178cb160 100644 --- a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx @@ -113,7 +113,7 @@ const RemixApp = (props: IRemixAppUi) => { _paq.push(['trackEvent', 'enterDialog', 'usageType', 'beginner']) break } - case UsageTypes.Tutor: { + case UsageTypes.Advance: { _paq.push(['trackEvent', 'enterDialog', 'usageType', 'tutor']) break } @@ -135,8 +135,8 @@ const RemixApp = (props: IRemixAppUi) => { - {setShowEnterDialog(true)}}> - handleUserChosenType(type)}> + {console.log("ok"); setShowEnterDialog(true)}}> + handleUserChosenType(type)}>
{props.app.menuicons.render()} diff --git a/libs/remix-ui/app/src/lib/remix-app/types/index.ts b/libs/remix-ui/app/src/lib/remix-app/types/index.ts index 0037fd6cb8..217d6ea5c0 100644 --- a/libs/remix-ui/app/src/lib/remix-app/types/index.ts +++ b/libs/remix-ui/app/src/lib/remix-app/types/index.ts @@ -10,7 +10,7 @@ export const enum ModalTypes { export const enum UsageTypes { Beginner = 1, - Tutor, Prototyper, - Production, + Advance, + Production } \ No newline at end of file From 4a0c4857b40190a9c6eb071e746fc4331e353c06 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 7 Dec 2023 11:02:10 +0100 Subject: [PATCH 4/7] fix display order --- apps/remix-ide/src/app.js | 8 +++++--- apps/remix-ide/src/walkthroughService.js | 15 +-------------- .../lib/remix-app/components/modals/enter.tsx | 12 ++---------- .../app/src/lib/remix-app/remix-app.tsx | 18 ++++++++++++++---- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 970837c9f3..30ead7e4fe 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -130,10 +130,12 @@ class AppComponent { 'remix.ethereum.org': 23, '6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod': 35 // remix desktop } - this.showMatamo = true /*matomoDomains[window.location.hostname]*/ && !Registry.getInstance().get('config').api.exists('settings/matomo-analytics') - this.showEnter = !this.showMatamo && !localStorage.getItem('hadUsageTypeAsked') - this.walkthroughService = new WalkthroughService(appManager, !this.showMatamo || !this.showEnter) + this.matomoConfAlreadySet = Registry.getInstance().get('config').api.exists('settings/matomo-analytics') + this.matomoCurrentSetting = Registry.getInstance().get('config').api.get('settings/matomo-analytics') + this.showMatamo = matomoDomains[window.location.hostname] && !this.matomoConfAlreadySet + + this.walkthroughService = new WalkthroughService(appManager) const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080'] // workaround for Electron support diff --git a/apps/remix-ide/src/walkthroughService.js b/apps/remix-ide/src/walkthroughService.js index 88f879d442..de21208e3f 100644 --- a/apps/remix-ide/src/walkthroughService.js +++ b/apps/remix-ide/src/walkthroughService.js @@ -11,21 +11,8 @@ const profile = { } export class WalkthroughService extends Plugin { - constructor (appManager, showWalkthrough) { + constructor (appManager) { super(profile) - /*let readyToStart = 0; - appManager.event.on('activate', (plugin) => { - if (plugin.name === 'udapp') readyToStart++ - if (readyToStart == 2 && showWalkthrough) { - this.start() - } - }) - appManager.event.on('activate', (plugin) => { - if (plugin.name === 'solidity') readyToStart++ - if (readyToStart == 2 && showWalkthrough) { - this.start() - } - })*/ } startRecorderW () { diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx index 540b2f228c..a508396880 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx @@ -4,25 +4,17 @@ import {UsageTypes} from '../../types' import { type } from 'os' interface EnterDialogProps { - show: boolean, handleUserChoice: (userChoice: UsageTypes) => void, } const EnterDialog = (props: EnterDialogProps) => { - const [visibility, setVisibility] = useState(false) - const {showEnter} = useContext(AppContext) - - useEffect(() => { - setVisibility(props.show) - console.log("useeff vis in enter", props.show, " showEnter ", showEnter) - }, [props.show]) + const [visibility, setVisibility] = useState(true) const enterAs = async (uType) => { props.handleUserChoice(uType) } - const modalClass = (visibility && showEnter) ? "d-flex" : "d-none" - console.log("enterDialog class ", modalClass) + const modalClass = visibility ? "d-flex" : "d-none" return (
{ activateApp() } const hadUsageTypeAsked = localStorage.getItem('hadUsageTypeAsked') - setShowEnterDialog(!hadUsageTypeAsked) + if (props.app.showMatamo) { + // if matomo dialog is displayed, it will take care of calling "setShowEnterDialog", + // if the user approves matomo tracking. + // so "showEnterDialog" stays false + } else { + // if matomo dialog isn't displayed, we show the "enter dialog" only if: + // - it wasn't already set + // - (and) if user has given consent + if (!hadUsageTypeAsked && props.app.matomoCurrentSetting) { + setShowEnterDialog(true) + } + } }, []) function setListeners() { @@ -87,7 +98,6 @@ const RemixApp = (props: IRemixAppUi) => { const value = { settings: props.app.settings, showMatamo: props.app.showMatamo, - showEnter: props.app.showEnter, appManager: props.app.appManager, modal: props.app.notification, layout: props.app.layout @@ -135,8 +145,8 @@ const RemixApp = (props: IRemixAppUi) => { - {console.log("ok"); setShowEnterDialog(true)}}> - handleUserChosenType(type)}> + setShowEnterDialog(true)}> + {showEnterDialog && handleUserChosenType(type)}>}
{props.app.menuicons.render()} From 12116157b194dac8fb0489cf39c88305a53b4264 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 7 Dec 2023 11:28:18 +0100 Subject: [PATCH 5/7] remove uneeded --- .../remix-ui/app/src/lib/remix-app/components/modals/enter.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx index a508396880..bff24b9072 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx @@ -8,13 +8,12 @@ interface EnterDialogProps { } const EnterDialog = (props: EnterDialogProps) => { - const [visibility, setVisibility] = useState(true) const enterAs = async (uType) => { props.handleUserChoice(uType) } - const modalClass = visibility ? "d-flex" : "d-none" + const modalClass = "d-flex" return (
Date: Thu, 7 Dec 2023 11:47:30 +0100 Subject: [PATCH 6/7] update mainnet node url --- apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx b/apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx index a593eeee29..e7f288448f 100644 --- a/apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx +++ b/apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx @@ -18,7 +18,7 @@ export class MainnetForkVMProvider extends BasicVMProvider { ) this.blockchain = blockchain this.fork = 'shanghai' - this.nodeUrl = 'https://mainnet.infura.io/v3/7eed077ab9ee45eebbb3f053af9ecb29' + this.nodeUrl = 'https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38' this.blockNumber = 'latest' } From bf6eb27b720df6e88b9fa7a2f62d4e649603fb2d Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 7 Dec 2023 12:57:18 +0100 Subject: [PATCH 7/7] fix using codeHash --- libs/remix-simulator/src/vm-context.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index 605a3bf971..4cd25f07f9 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -230,10 +230,11 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump { [], this.blockTag, ]) + const codeHash = accountData.codeHash === '0x0000000000000000000000000000000000000000000000000000000000000000' ? '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470' : accountData.codeHash const account = Account.fromAccountData({ balance: BigInt(accountData.balance), nonce: BigInt(accountData.nonce), - codeHash: toBuffer(accountData.codeHash) + codeHash: toBuffer(codeHash) // storageRoot: toBuffer([]), // we have to remove this in order to force the creation of the Trie in the local state. }) return account